Alternate EAs

 

Hi, guys!

Is there any way of stopping an EA of working? Let me explain.

I have 2 EAs, but I want to use only one of them each time. So, If EA-1 has an open order, I don't want EA-2 to open another order. When that first order is closed, I would like to allow both EAs to work together again. And so on, if EA-2 opens an order, EA-1 stops until that order is closed.

 
Iury Mendes Da Silva:

Hi, guys!

Is there any way of stopping an EA of working? Let me explain.

I have 2 EAs, but I want to use only one of them each time. So, If EA-1 has an open order, I don't want EA-2 to open another order. When that first order is closed, I would like to allow both EAs to work together again. And so on, if EA-2 opens an order, EA-1 stops until that order is closed.

If they both allowed to open just one order, the easiest way is to use PositionsTotal() == 0 for both (in mt5) and only when it's 0 allow opening a new position.

If more than one position allowed to ea - use different magic numbers for each ea.
Reason: