Chart Control Remains on the Chart even after bot has stopped
25 Aug 2024, 22:18
Hello Spotware,
I'm having an issue in which using Chart.MoveControl() for controls attached to the chart using the price, index/date overload makes it impossible to remove it afterwards, even after the bot is stopped, it remains there.
The only way I have to circumvent this is not using Chart.MoveControl() altogether but rely on add/remove repeatedly.
I think there's no other way to remove a Control and it's an issue, if I'm doing something wrong, please let me know.
Here's the sample code and video:
cTrader - 2024-08-25_17-20-13 - TechSmith Screencast - TechSmith Screencastusing System;using cAlgo.API;using cAlgo.API.Collections;using cAlgo.API.Indicators;using cAlgo.API.Internals;namespace cAlgo.Robots;[Robot(AccessRights = AccessRights.None, AddIndicators = true)]public class RemoveButtonIssue : Robot{ private Button _button; private int _counter; protected override void OnStart() { _button = new Button { Text = "Click Me", Width = 100, Height = 50, }; Chart.AddControl(_button, Bars.Count - 1 - 10, Ask); Timer.Start(3); } protected override void OnTimer() { //this seems to work fine // Chart.RemoveControl(_button); // Chart.AddControl(_button, Bars.Count - 1 - 10, Ask + ++_counter * Symbol.PipSize); //When it is moved, it will not be removed even after stopping the robot Chart.MoveControl(_button, Bars.Count - 1 - 10, Ask + ++_counter * Symbol.PipSize); } protected override void OnStop() { Chart.RemoveControl(_button); }}
Regards,
Replies
PanagiotisCharalampous
05 Sep 2024, 04:56
Hi Waxy,
It will be fixed in 5.1.
Best regards,
Panagiotis
@PanagiotisCharalampous

AlgoCorner
05 Sep 2024, 02:23
Hello Spotware,
It seems this issue has gotten worse, as I'm not able to edit the control text anymore.
I also can't remove it and place a new instance, this looks broken on multiple levels, I would appreciate support.
Regards,
@AlgoCorner