mql4 function to turn on and off autotrading

Back to topics list To post a new topic, please log in or register
avatar
51
7325453863 2015.12.31 16:05
 

Happy New Year to everyone!


I want to turn off auto-trading from within my mql4 ea when a target equity is reached. I know there is a mql4 function to do this but I can not find it. I tried searching with no success.

I would appreciate if someone can tell me where I find some documentation or example.


Thanks.

avatar
2017
gooly 2015.12.31 16:20 #
 
What about ExpertRemove()?
avatar
735
honest_knave 2015.12.31 16:30 #
 
7325453863:

Happy New Year to everyone!


I want to turn off auto-trading from within my mql4 ea when a target equity is reached. I know there is a mql4 function to do this but I can not find it. I tried searching with no success.

I would appreciate if someone can tell me where I find some documentation or example.


Thanks.

 

Not my knowledge. You can find out if AutoTrading is enabled:

TerminalInfoInteger(TERMINAL_TRADE_ALLOWED);

 

You can also remove an EA from your chart:

ExpertRemove();

 

 Even more extreme, you can also force your terminal to close:

TerminalClose(1);

 

But it may be better to code your EA so that it doesn't trade if your equity is above a certain level using

AccountEquity();

 

Depending on what your EA is doing, you can run this check before a trade is placed, or at the start of OnTick().

 

Hope that helps. 

 


avatar
51
7325453863 2015.12.31 16:45 #
 
honest_knave:

 

Not my knowledge. You can find out if AutoTrading is enabled:

 

You can also remove an EA from your chart:

 

 Even more extreme, you can also force your terminal to close:

 

But it may be better to code your EA so that it doesn't trade if your equity is above a certain level using

 

Depending on what your EA is doing, you can run this check before a trade is placed, or at the start of OnTick().

 

Hope that helps. 

 



avatar
51
7325453863 2015.12.31 16:48 #
 
7325453863:

Thanks for the suggestions. I think I will use expertremove function.
Back to topics list  

To add comments, please log in or register