How to put start button back to the stopped state?
Created at 09 Mar 2025, 18:03
How to put start button back to the stopped state?
09 Mar 2025, 18:03
Hi,
My algo has a few conditions that have to be met in order to Start() the algo.
If the conditions are not met the algo does not call Start() but the start button still shows it is running.
Is there a way to handle this in the code so that the start button is flipped back to the stopped state?
TIA
firemyst
10 Mar 2025, 00:42 ( Updated at: 10 Mar 2025, 00:44 )
What do you mean?
If the algo has conditions that need to be met to Start(), then the algo is already running if it's looking to meet these conditions. An algo can't be running to see if it meets conditions to “start” and have the button not showing as “running”.
If the button isn't showing as running, then algo isn't running.
I'm not sure you understand the events in algo?
The “start” method is what's executed when the bot is started. There's no conditions to determine if it runs or not unless you somehow start one algo from another algo.
If you are starting the algo by clicking the start button itself, and if you don't want a robot to actually do anything until a condition is met, then you need to check that condition in the OnTick method. When the condition is met, then you go to another branch and do what you want.
Example:
protected override void OnTick()
{
if (! your_condition_is_met)
{
///return or do whatever and wait for the next tick to come through to see if your condition is met
}
else //your condition is met
{
///do what you want your bot's algo to do when the conditions are met
}
}
@firemyst