Terminate EA when Equity is above a certain number
-
I am trying to terminate my EA when my equity reached a certain number that I provide in the input of starting the EA. I also want to close all trades at this point.
Something went terribly wrong with this code. I am not sure what happened. But I noticed the following:
- My equity has not reached the number that I had input.
- It still terminated my EA.
- It did not close any trades.
- I did get the Alert message so seems like the condition did pass.
How is all this possible? Any ideas?



-
your equity has not reached it? are you sure about?
because maybe it has reached, trade closing was rejected by broker
these broker tricks happened often to me ... be little smarter against these tricks, take inspiration from this mine: -
Yes I am 100% sure my equity didn't reach.
Any idea what could have happened? Why did my EA terminate? Obviously my equity at some point even for 1 second might have reached due to whatever reason. What could be such reasons? Also even if that happened why my trades didn't close?
I checked your blocks and code, how is it different than what I am doing?
-
it is different in more robust logic, when equity reach point, variable terminatingActive become "true" and at this point Close trades block is repeating itself up to situation where no trade exist and EA is terminated only in situation when no trade exist ...
I dont know another reason why it happened to you, only broker reasons/issues

