how can I mix varius EAs in one ... and not get killed by the orders?

 

Hi

I various EAs, and would like to put them all in a EA, but have realized the problem of closing the orders ... how can I do that without closing the orders of another EA?

 

Depends on how it/they is/are coded; ask the owner, or provide the code.

Magic number only allows an EA to identify its trades from all others. Using OrdersTotal/OrdersHistoryTotal (MT4) or PositionsTotal (MT5), directly and/or no Magic number/symbol filtering on your OrderSelect / Position select loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
          Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum (2013)
          PositionClose is not working - MQL5 programming forum (2020)
          MagicNumber: "Magic" Identifier of the Order - MQL4 Articles (2006)
          Orders, Positions and Deals in MetaTrader 5 - MQL5 Articles (2011)
          Limit one open buy/sell position at a time - General - MQL5 programming forum (2022)

You need one Magic Number for each symbol/timeframe/strategy.
     Trade current timeframe, one strategy, and filter by symbol requires one MN.
     If trading multiple timeframes, and filter by symbol requires use a range of MN (base plus timeframe).
          Why are MT5 ENUM_TIMEFRAMES strange? - General - MQL5 programming forum - Page 2 #11 (2020)

 
William Roeder #:
ade current timeframe, one strategy, and filter by symbol requires one

couldn't I make an array for each  sell or buy of each strategy (in the same EA), and insert the tickets in its corresponding array, and after that filter each close by ticket?

how could I do this?

 
Javier Santiago Gaston De Iriarte Cabrera #: couldn't I make an array for each  sell or buy of each strategy (in the same EA), and insert the tickets in its corresponding array, and after that filter each close by ticket? how could I do this?

Just use a different magic number for each strategy, just as one would use a different magic number for each EA.

I am just rephrasing what William has already stated ... "You need one Magic Number for each symbol/timeframe/strategy. Trade current timeframe, one strategy, and filter by symbol requires one MN."

 
0k, thanks , much more easy!
 

and, what do I use to close?

If I use this:

trade.PositionClose(_Symbol,5);

all orders are close?


(or this will only close the filtered?)

 
I might have not expressed correctly.... I mean I have 5 different strategies in the same EA (all the same pariod and symbol)
 
Javier Santiago Gaston De Iriarte Cabrera #I might have not expressed correctly.... I mean I have 5 different strategies in the same EA (all the same pariod and symbol)

You have already been answered ... twice!