EA multiple chart other pair interference

 

Hi,


What is the best method to stop interference when running EA on multiple pair? I'm getting wrong indicator from the wrong pair on my chart. Would something like below do the trick by using _Symbol == _Symbol ??

  if(BuySignal>=NumberOfSignal && _Symbol == _Symbol)
     {
      SellBuy(BuyAmount,AskPrice,AskStopLoss,AskTakeProfit,MaxPair,RandomSignal);
     
     }

   if(SellSignal>=NumberOfSignal && _Symbol == _Symbol)
     {
      SellBuy(BuyAmount,BidPrice,BidStopLoss,BidTakeProfit,MaxPair,RandomSignal);

     }
 

No that won't work.

Use a Magic Number.

 
mrwick: What is the best method to stop interference when running EA on multiple pair?
Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect 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
          MagicNumber: "Magic" Identifier of the Order - MQL4 Articles
 

Thank you. What are we using instead of OrderMagicNumber() in mql5 ?

'OrderMagicNumber' - function not defined Main_Random_Strategy_v2.mq5 152 7


Reason: