Au Phuong Tan: I'm using MT5 and facing an issue where, when a position with a set Stop Loss is closed, the magic number gets removed. I've used the following code to print the magic number in the history. Stop Loss positions are marked as shown in the image. Checking the history, those positions have had their magic number removed. Positions closed by the EA still retain their magic number. I calculate the total profit using a filter for the magic number, but this issue causes positions without a magic number to be excluded from the calculation.
Please note that a similar issue has been reported for traders using Exness (see below). Is this your case? If so please discuss the issue with your broker.

No magic no. associated post pending order gets filled
- 2024.10.28
- Utkarsh Katiyar
- www.mql5.com
Hi All, I have run into this weird problem from 24th October, the pending orders when placed show a magic number associated with them but when the...

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'm using MT5 and facing an issue where, when a position with a set Stop Loss is closed, the magic number gets removed. I've used the following code to print the magic number in the history.
Stop Loss positions are marked as shown in the image.
Checking the history, those positions have had their magic number removed.
Positions closed by the EA still retain their magic number. I calculate the total profit using a filter for the magic number, but this issue causes positions without a magic number to be excluded from the calculation.
Please help me. Thank you for reading.