Simple button to change a variable output
-
Hey,
I have been trying to create a simple button that changes a variables state from TRUE to False. When True the EA is allowed to take a specific set of trades and when false it takes no trades.
The image below shows my 'on chart' button logic which is simple. The variable is initially set to False. So when the variable is False the condition block allows it through and when the button is clicked the variable is changed from False to True and the EA can take trades. This part works fine and I can see this on my chart via a comment block which shows the out of the variable 'Trade on'.
However, i am struggling to change the variable back to false when i click the button again. Can anybody see a reason why it wouldn't change back to False?
Thanks for any help, Adam.

-
I will suggest to put those purple blocks always on the top. I think logically it is better. Because that "on Chart" event fires on wide range of chart events and it's better to filter the events first and then do something else.
Try this example: https://fxdreema.com/shared/sKFJN0Ffb I'm setting the value in the variable in the Condition block, you will see. Then on the Alert you will see values 0 or 1, but it is the same as false and true.