EA And Magic Number

 

Im looking for some advice on how the Magic number will affect my EA.

Currently i have my ea using the same magic number across all 6 of my chosen currency pairs. I also have the max trades open on the magic number set to 1. Will this stop the EA from open 2 different currency trades at the same time?

id like it to be able to open multiple trades on seperate currencies, but only 1 trade at a time per currency. Hope this makes sense.

Advice appreciated.

 
You can check the symbol of the trades with OrderSymbol() and confirm you only have 1 with such magic number in such pair.
 
Hi, Expert Advisor must have a different magic number, this number is for platform to recognize different EA. If you want open one transaction per pair, you need to set this in each EA separately. Regards Greg
 
Greg Pawlak:
Hi, Expert Advisor must have a different magic number, this number is for platform to recognize different EA. If you want open one transaction per pair, you need to set this in each EA separately. Regards Greg

No.

You do not know how EA is coded, why do you said "MUST" and "NEED TO" ?

It's all about how EA is coded, usually magic number is used to identify EA, not symbols. So same EA use same magic number across multiple pairs but, as I already said, without EA code is impossibile for us to understand what is the situation.

 
Greg Pawlak:
Hi, Expert Advisor must have a different magic number, this number is for platform to recognize different EA. If you want open one transaction per pair, you need to set this in each EA separately. Regards Greg

does not need to! A properly coded expert adviser works with same magic no matter how many different symbol charts you have opened with same adviser....it's a matter of properly handle the OrderSymbol function and OrderMagic function. 

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
 
Depends on how it/they is/are coded.

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
 
Fabio Cavalloni:

No.

You do not know how EA is coded, why do you said "MUST" and "NEED TO" ?

It's all about how EA is coded, usually magic number is used to identify EA, not symbols. So same EA use same magic number across multiple pairs but, as I already said, without EA code is impossibile for us to understand what is the situation.

I have my own reasons why I use the word "MUST" and "NEED TO" if you want to use same magic number for all Expert Advisors, is your choice:). Regards Greg

 
Greg Pawlak:

I have my own reasons why I use the word "MUST" and "NEED TO" if you want to use same magic number for all Expert Advisors, is your choice:). Regards Greg

Probably I misunderstood what you mean in previous post...

Anyway my last post clarifies it:

It's all about how EA is coded, usually magic number is used to identify EA, not symbols. So same EA use same magic number across multiple pairs but, as I already said, without EA code is impossibile for us to understand what is the situation.