Just found small thread about it : Magic numbers
doshur:
MT5 : I usually use magic number to diff the position of order. example : diff lot or detect diff negative value of profit.In MT4, using magic can sort out which position is sent by which EA and managed independently.
But in MT5, all are merged into one position so is there any use for magic number?
if( PositionSelect("EURCHF")==true &&PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY && PositionGetInteger(POSITION_MAGIC)==123231 && PositionGetDouble(POSITION_VOLUME)==loturus+2 ) { double asalz2 = PositionGetDouble(POSITION_PRICE_OPEN); double currentz2 = PositionGetDouble(POSITION_PRICE_CURRENT); if(asalz2-currentz2>300*Poin) { fBuyL3(); } } if( PositionSelect("EURCHF")==true &&PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY && PositionGetInteger(POSITION_MAGIC)==878763 && PositionGetDouble(POSITION_VOLUME)==loturus+3 ) { double asalz3 = PositionGetDouble(POSITION_PRICE_OPEN); double currentz3 = PositionGetDouble(POSITION_PRICE_CURRENT); if(asalz3-currentz3>300*Poin) { fBuyL4(); } }
doshur:
In MT4, using magic can sort out which position is sent by which EA and managed independently.
But in MT5, all are merged into one position so is there any use for magic number?
https://www.mql5.com/en/forum/15482
The Use of ORDER_MAGIC for Trading with Different Expert Advisors on a Single Instrument
The Optimal Method for Calculation of Total Position Volume by Specified Magic Number
![Usefulness (or not) of the magic number with MQL5. Usefulness (or not) of the magic number with MQL5.](https://c.mql5.com/36/0/usefulness-or-not-of-the-magic.png)
Usefulness (or not) of the magic number with MQL5.
- www.mql5.com
Magic number can be used to distinguish trades from different EA also with MT5.
it is so confusing
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
In MT4, using magic can sort out which position is sent by which EA and managed independently.
But in MT5, all are merged into one position so is there any use for magic number?