Disable EA from opening new orders but Trail or Close previously opened orders.

 
Hello,

Is there anyway to prevent an EA from opening new orders (Daily at time X)  but maintain previously opened orders. 

Edit: I don't have the source code and cannot modify the EA.
 

You can make dll call or use this function : ExpertRemove();  and in the indi (separated from your ea) just give a condition that if time > x then call Expert remove function.

In this way you will remove ea from chart, which will prevent from opening trades. Unfortunately if you dont have source code, there is not much you can do.

 

Here is the dll function call that you can use instead of ExpertRemove, before that function you must include this:  #include <WinUser32.mqh> 

PostMessageA( WindowHandle( Symbol(), Period()), WM_COMMAND, 33050, 0);  
 
Bartlomiej Gorski:

You can make dll call or use this function : ExpertRemove();  and in the indi (separated from your ea) just give a condition that if time > x then call Expert remove function.

In this way you will remove ea from chart, which will prevent from opening trades. Unfortunately if you dont have source code, there is not much you can do.

But this would remove the expert right. The expert is supposed to maintain already opened orders and decides when to close them.

 
You are right, but there is no way to prevent ea from trading and still control other orders if you dont have source code. Either you remove ea and stop it permanently or you need source. You can also programaticaly click "auto trading" button, so ea will stay on chart, but if auto trading is off then it wont be able to modify/close existing orders either. So there is no option that you can do what you want without source.
 
Bartlomiej Gorski:

Here is the dll function call that you can use instead of ExpertRemove, before that function you must include this:  #include <WinUser32.mqh> 

PostMessageAWindowHandle( Symbol(), Period()), WM_COMMAND, 33050, 0);  
 
Bartlomiej Gorski:
You are right, but there is no way to prevent ea from trading and still control other orders if you dont have source code. Either you remove ea and stop it permanently or you need source. You can also programaticaly click "auto trading" button, so ea will stay on chart, but if auto trading is off then it wont be able to modify/close existing orders either. So there is no option that you can do what you want without source.

Thank you :)

 

I have an EA that was coded to manage other EAs which has settings to function within certain hours only. The main function of my Ea is that it allows you to turn on and off Autotrade function from Monday to Sunday within certain hours of the day. Each day has a Start time and a End time. The start time turns on autotrade and End time is the time the Ea will start monitoring for any close orders/close trades. If it detects any close trades it then checks for any remaining open positions and if there are no opened positions the Autotrade function is now disabled. This however should only be used for a single ea on a single chart. The Ea is not free also. 

 

is it possible to close positions using

PostMessageA

like as you click on close X sign next to position?If it is possible it will work when AutoTrading is disabled.

Another idea is to programmatically disable check box "Allow live trading" of the EAs on other charts.

Reason: