Yes but then you have to select the positions (e.g. for trailing the stops) by the ticket AND the symbol!
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.
It really depends on how the EA deals with Magic Number.
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....
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.
Please do not reply inside the quote box.
I have edited your 2 posts and moved your replies
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...
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)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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