How can we know magic number of an open trade in MT4?

 

Dear everybody,


I have an EA that I run simultaneously on several charts at once, on just one symbol pair, but with different time frames. Of course I did this as a strategy to reduce the risk as small as possible. But the problem is, if a trade is opened by the EA, on more than one chart simultaneously, and I have to evaluate which trade comes from a particular chart, I can't do it because the magic number cannot be known in MT4.

I can find out the magic number of a trade easily in MT5. Is there a method or indicator or EA that can help identify magic numbers in MT4? Thank you for the info

 
Your topic has been moved to the section: MQL4 and MetaTrader 4
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 

The magic numbers are openly available in MT4, both via the MQL4 programming, as well as on your trading history.

In your code, once you have selected the order via OrderSelect, you can obtain its magic number via the function OrderMagicNumber.

OrderSelect - Trade Functions - MQL4 Reference
OrderSelect - Trade Functions - MQL4 Reference
  • docs.mql4.com
OrderSelect - Trade Functions - MQL4 Reference
 
I'm not the developer of the EA, and I can't write a code to build an EA. I'm just a user. When the trades still open, how can I know the magic number of that trade in MT4?
 
Wan Suryolaksono #: Thanks, now I'm waiting for the idea to solve this problem....
What do you mean by "I'm waiting for the idea to solve this problem"?
 
Wan Suryolaksono #: I'm not the developer of the EA, and I can't write a code to build an EA. I'm just a user. When the trades still open, how can I know the magic number of that trade in MT4?
As I stated, the Magic number is visible in the Trade History. Just hover over the ticket number of the order with your mouse and a tooltip will appear.
 
Fernando Carreiro #:
As I stated, the Magic number is visible in the Trade History. Just hover over the ticket number of the order with your mouse and a tooltip will appear.

Thank you very very much for your help. I don't know about tooltip when hovering the ticket number can give this important info. Thanks again

Reason: