Thomas19890620:
Hi,
Could anyone tell me, is there a way to automatically stop the EA if the equity is less than a predetermined value. Is there a bulit-in function in MT5
check ExpertRemove() function.

Documentation on MQL5: Common Functions / ExpertRemove
- www.mql5.com
ExpertRemove - Common Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
With this approach, the ExpertAttach() function would be required to return the expert to the chart when the equity again become greater than the value from the settings😄
Thomas19890620:
Hi,
Could anyone tell me, is there a way to automatically stop the EA if the equity is less than a predetermined value. Is there a bulit-in function in MT5
- If you have the source code of the EA that you want to stop, then you need to make changes to it. Namely, check equity before sending trade requests.
- If you do not have the source code, then it is much more difficult, but still implementable. But anyway, this option is worse than changes to the source code of the adviser
void OnTick() { double MaxDrawDown = 5 ; if(((1-(AccountEquity()/AccountBalance()))*100)>MaxDrawDown) { //here you can put any order like delete PendingOrder or CloseBUY or CloseSELL } }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
Could anyone tell me, is there a way to automatically stop the EA if the equity is less than a predetermined value. Is there a bulit-in function in MT5