Need to hear your opinion on how 2 EA will affect each other if it's the same EA and magic number, only the direction is different

 

Hi,

I have a strategy that I want to separate between settings of long position and sell position. To simplify the process I will put a 2 same EA one with long position trade only and the other short position trade only. All the other parameter is the same including OpenPositionTicket[] to store ticket number and also the same magic number. The flow to open a position like snippet of the code below.

void ProcessProcessingBarsTradeOpens(int SymbolLoop, ENUM_TIMEFRAMES TradeTimeframe, TRADE_DIRECTION TradeDirection, ulong& PositionTicket, ...) {
   string CurrentSymbol = SymbolArray[SymbolLoop];

   Print("open position ticket: ", PositionTicket, " for symbol ", CurrentSymbol);
   //... return when there is an open position
   if(PositionTicket > 0) {\
      return;
   }

   //--- 1. COPY INDICATOR BUFFER
   ...
   ...

   //--- 2. INSERT YOUR ENTRY LOGIC HERE
   ...
   ...

   //--- 3. FILTER TRADE
   //... check for signal
   if(openSignal == OPEN_IDLE)
      return;

   //... check for market open
   if(!IsMarketOpen(SymbolArray[SymbolLoop])) {
      Print("MARKET CLOSED");
      return;
   }

   //... check for maximum spread
   if(iSpread(CurrentSymbol, TradeTimeframe, iBarToUseForProcessing) > MaxSpread)
      return;


   //--- 4. PROCESS TRADE OPEN
   CTrade trade;
   MqlTick tick;
   SymbolInfoTick(CurrentSymbol, tick);
   double volume = 0, price = 0, sl = 0, tp = 0;

   //... long position
   if(openSignal == OPEN_LONG) {
      ...
      ...

      trade.SetDeviationInPoints(Slippage);
      trade.SetExpertMagicNumber(MagicNumber);
      Print("===== TRADE PARAMETER >>>>> Symbol: ", CurrentSymbol, ", Price: ", price, ", sl: ", sl, ", tp: ", tp);
      if(!trade.Sell(Volume, CurrentSymbol, price, sl, tp))
         Print("===== ERROR - failed to open sell position with error code ", GetLastError(), " =====");
   }

   if(openSignal == OPEN_SHORT) {
      ...
      ...

      trade.SetDeviationInPoints(Slippage);
      trade.SetExpertMagicNumber(MagicNumber);
      Print("===== TRADE PARAMETER >>>>> Symbol: ", CurrentSymbol, ", Price: ", price, ", sl: ", sl, ", tp: ", tp);
      if(!trade.Sell(Volume, CurrentSymbol, price, sl, tp))
         Print("===== ERROR - failed to open sell position with error code ", GetLastError(), " =====");
   }

   PositionTicket = trade.ResultOrder();
}

at the last of open position function above, I will store the order ticket to a PositionTicket variable (OpenPositionTicket[]). This OpenPositionTicket[] is exist both in LongPositionOnly EA and also in ShortPositionOnly EA. My question is if there's already a buy position ticket in LongPositionOnly EA and the next bar the ShortPositionOnly EA open a sell position does it will effect the OpenPositionTicket[] on the LongPositionOnly EA?


notes:
- there is no code in my EA to loop through all open position and select the symbol and magic number, so the problem of sell position ticket to write off or affecting the first long position ticket will never happen.
- since basically there's 2 variable to store the ticket in 2 different EA the possibility to create an error is small and this is the part where I want to hear your opinion.

Reason: