One Chart multiple Symbol with different Magic

 
string syms[] = {"EURGBP","EURUSD"};

for(int i=0; i < ArraySize(syms); i++) {

}

its working. How to add random magic number for specific symbol, or magic number can be whatever only different from other symbol?

I used one chart for multiple symbols.

 
chris.dotan: its working. How to add random magic number for specific symbol, or magic number can be whatever only different from other symbol? I used one chart for multiple symbols.

You don't need a different magic number for each symbol. You can use the same magic number, but your code must check the symbol of the orders.

 

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

You need one Magic Number for each symbol/timeframe/strategy. Trade current timeframe, one strategy, and filter by symbol requires one MN.

Reason: