Magic number

 

Hi traders,

If I run the same expert on more than one chart but different pairs for the same account.

Can I use the same magic number for all pairs?


Thanks

 
Yes but then you have to select the positions (e.g. for trailing the stops) by the ticket AND the symbol!
 
Carl Schreiber:
Yes but then you have to select the positions (e.g. for trailing the stops) by the ticket AND the symbol!
Thanks,  so the same magic number will work fine for all pairs if I don't use trailing stop?
 
Husain Dana:

Hi traders,

If I run the same expert on more than one chart but different pairs for the same account.

Can I use the same magic number for all pairs?


Thanks

It really depends on how the EA deals with Magic Number. 

 
Mohammad Hossein Sadeghi:

It really depends on how the EA deals with Magic Number.



Thanks Mohammad
 

a correctly coded expert adviser handle it's own orders always by magic and symbol regardless of how many charts it's attached to or you use other advisers on the same account.

But this should not be taken for granted as not all advisers uses this correct....

 
Kenneth Parling:

a correctly coded expert adviser handle it's own orders always by magic and symbol regardless of how many charts it's attached to or you use other advisers on the same account.

But this should not be taken for granted as not all advisers uses this correct....

Great.. 

thanks a lot for all prompt replies

I will test that on a demo account and confirm if it's ok.

 
Husain Dana:

Please do not reply inside the quote box.

 I have edited your 2 posts and moved your replies

 
Keith Watford:

Please do not reply inside the quote box.

 I have edited your 2 posts and moved your replies


Surely will do that in the future....

Anyway I tested the advisor on 10one-minute charts with diffrent pairs.

It seems to work perfectly without any interference with the other pairs with the same magic number.


Thanks to all...

 
Hi Alessio. Thank you very much for your work!!! I used this EA Range 1.01 in XAU/USD only in a one minute time frame and had excellent results. Even in long trends the drawdown was small, and gained almos 500 dlls ina a week in a 2,500 dlls account. Can you adjust the distance grid? What is Input parameters for the minimum stop loss and take profit in points?
 

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)
          Limit one open buy/sell position at a time - General - MQL5 programming forum (2022)

You need one Magic Number for each symbol/timeframe/strategy.
     Trade current timeframe, one strategy, and filter by symbol requires one MN.
     If trading multiple timeframes, and filter by symbol requires use a range of MN (base plus timeframe).
          Why are MT5 ENUM_TIMEFRAMES strange? - General - MQL5 programming forum - Page 2 #11 (2020)