Topics
Replies
krsnv
08 Apr 2024, 10:59
( Updated at: 09 Apr 2024, 05:14 )
RE: Why are my controls being reset when starting cBot instance on another symbol?
PanagiotisCharalampous said:
Hi there,
Please share your code and exact steps to reproduce this problem.
Best regards,
Panagiotis
Hi! Here's the code example. I run it on USDJPY. You should see two radio buttons in the top left corner. The “Limit” one is checked by default.
Then I start my bot on another symbol (XAUUSD). Limit is also checked by default.
But if I go back to USDJPY I can see that the Limit radio button on the first bot instance is unchecked. As I mentioned in the above message, something triggers OnUnchecked event and when I debug, the stacktrace shows it's being done by external code, meaning it's not my code who calls for Uncheck.
using cAlgo.API;
namespace cAlgo.Robots;
[Robot(AccessRights = AccessRights.None)]
public class RadioButtonResetExample : Robot
{
protected override void OnStart()
{
var mainPanel = new StackPanel();
var limitRadioButton = new RadioButton
{
Text = "Limit",
IsChecked = true,
GroupName = "OrderType",
Margin = 10,
};
var marketRadioButton = new RadioButton
{
Text = "Market",
IsChecked = false,
GroupName = "OrderType",
Margin = 10,
};
mainPanel.AddChild(limitRadioButton);
mainPanel.AddChild(marketRadioButton);
Chart.AddControl(mainPanel);
}
}
@krsnv
krsnv
15 Apr 2024, 12:17
RE: Why are my controls being reset when starting cBot instance on another symbol?
PanagiotisCharalampous said:
Hi, any ideas?
@krsnv