You didn't provide one when closing.
You didn't provide one when closing.
GUI doesn't have an input to provide a magic number when closing a position.
Trade server is smart enough to know the position Ticket that corresponds with the closing positions, why couldn't the magic number also be included?
OPEN REQUEST Symbol: BTCUSD Type BUY Order 2478343Action 1 Price 0.0 Volume 0.01 Magic 1 Position Ticket 0 TP 0.0 SL 0.0
CLOSE REQUEST Symbol: BTCUSD Type SELL Order 2478344 Action 1 Price 0.0 Volume 0.01 Magic 0 Position Ticket 2478343 TP 0.0 SL 0.0
- www.mql5.com
If you manually close a position, magic will always be '0'.
You didn't provide one when closing.
Can you explain your answer please. Which function/method should be used to set a magic when closing?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
This script places a buy market execution with a magic number of 1.
This is an expert advisor that monitors the OnTradeTransaction "Request"
When the script is run, the expert advisor will print out the following
MqlTradeTransaction: REQUEST Symbol: BTCUSD Type BUY Order 2478343 Action 1 Price 0.0 Volume 0.01 Magic 1 Position Ticket 0 TP 0.0 SL 0.0
and when the position is closed, the expert advisor will print out the following
MqlTradeTransaction: REQUEST Symbol: BTCUSD Type SELL Order 2478344 Action 1 Price 0.0 Volume 0.01 Magic 0 Position Ticket 2478343 TP 0.0 SL 0.0
Why does the magic number equal 0, at the request to close the position?