Magic number for each pair?

 
Hi everyone
I was wondering if when using the same EA in several different pairs, will I have to change the magic number for each one?
In other words, each pair would have its magic number.
 
reimike123:
Hi everyone
I was wondering if when using the same EA in several different pairs, will I have to change the magic number for each one?
In other words, each pair would have its magic number.

It depends on how the EA is coded.

 
Keith Watford:

It depends on how the EA is coded.

if the EA check/save the currency pair?
 
reimike123:
if the EA check/save the currency pair?

What does that mean?

 
reimike123: I was wondering if when using the same EA in several different pairs, will I have to change the magic number for each one? In other words, each pair would have its magic number.
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 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
          PositionClose is not working - MQL5 programming forum
          MagicNumber: "Magic" Identifier of the Order - MQL4 Articles
          Orders, Positions and Deals in MetaTrader 5 - MQL5 Articles
 
William Roeder:
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 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
          PositionClose is not working - MQL5 programming forum
          MagicNumber: "Magic" Identifier of the Order - MQL4 Articles
          Orders, Positions and Deals in MetaTrader 5 - MQL5 Articles
so if i have the same magic number, i won't have any problems?
 

If you code it to filter for that.

Magic number is used to identify trades for their EA.

It's not to identify Pairs so it does not make sense to have a separate magic number for each pair since they have their own name already.

 
Marco vd Heijden:

If you code it to filter for that.

Magic number is used to identify trades for their EA.

It's not to identify Pairs so it does not make sense to have a separate magic number for each pair since they have their own name already.

so if the code has no filter is it better for each pair to have a different magic number?

 

No because it already has a ISO 4217 name. 

Why would you need a extra magic number for each pair ? 

Give me an example.

 
Marco vd Heijden:

No because it already has a ISO 4217 name. 

Why would you need a extra magic number for each pair ? 

Give me an example.

I think it is for EA to differentiate the trades of each pair

 

No it is for the EA's to differentiate between the trades of each EA.

Fields description:

magic

Expert Advisor ID. It allows organizing analytical processing of trade orders. Each Expert Advisor can set its own unique ID when sending a trade request.

It is called Expert Advisor ID 

Not Currency Pair ID.

Please read the documentation.

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
  • www.mql5.com
Trading is done by sending orders to open positions using the OrderSend() function, as well as to place, modify or delete pending orders. Each trade order refers to the type of the requested operation. Trading operations are described in the ENUM_TRADE_REQUEST_ACTIONS enumeration...