OrderMagicNumber(); // MQL4 Magic(); or POSITION_MAGIC // MQL5
See here: https://www.mql5.com/en/docs/standardlibrary/tradeclasses/cpositioninfo/cpositioninfomagic
And here: https://www.mql5.com/en/docs/constants/tradingconstants/positionproperties#enum_position_property_integer
Documentation on MQL5: Standard Library / Trade Classes / CPositionInfo / Magic
- www.mql5.com
Standard Library / Trade Classes / CPositionInfo / Magic - Reference on algorithmic/automated trading language for MetaTrader 5

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
I have open order by some EA which change the magic number each order.
How to find the magic number for this already open positions ?