I almost succeeded to send and cancel Orders with Mql5. For canceling I used Order ticket as in one sample. Trouble is that in "Trade" tab Order changes itself its status. Before change there exists ticket number (in "Trade" tab that ticket header is called "Order", ticket number is 1010733541) and "Type" is "buy limit", but after that anomalian change ticket number is lost and "Type" is changed to "buy". Because my program recognizes order via ticket number therefore it is unable to cancel that order afterward. Is it somehow possible that Order status stays unchanged?
Before anomaly:
After anomaly:
Thank you!!!
Put your branding in the orders comment.
If you detect no ticket , search by comments based on the order branding number.
To LoRio: Good idea at first sight, but after that change Order stays invisible to OrdersTotal() command. I didn't try yet but I am afraid that anomalian Order stays inaccessible with mql5 overall. It helps when somehow should be possible to cancel all Orders without ticket. Besides it is truly anomaly because sometimes that change happens and sometimes not. I cannot understand what has influence on that change.
Pending orders are just "orders" (commands to preform some trading operation in future on the server). When conditions of a pending order are met, the server executes another order - market order - so it has another ticket number.
Please, read this articale carefully - https://www.mql5.com/en/articles/211 - it explains how orders, deals, and positions work in MT5. Basically you should lookup the history for executed order, deal, and position in order to get ticket(s) of market orders which correspond to your pending order - yes, there can be several market orders (and tickets), because your pending order can be filled by parts.
![Orders, Positions and Deals in MetaTrader 5 Orders, Positions and Deals in MetaTrader 5](https://c.mql5.com/36/5/orders-positions-and-deals-in-metatrader__3.png)
- 2011.02.01
- MetaQuotes Software Corp.
- www.mql5.com
I imagine if you click x it stays there.What is the slippage on that order (if you open it with an EA)?
Pending orders are just "orders" (commands to preform some trading operation in future on the server). When conditions of a pending order are met, the server executes another order - market order - so it has another ticket number.
Please, read this articale carefully - https://www.mql5.com/en/articles/211 - it explains how orders, deals, and positions work in MT5. Basically you should lookup the history for executed order, deal, and position in order to get ticket(s) of market orders which correspond to your pending order - yes, there can be several market orders (and tickets), because your pending order can be filled by parts.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I almost succeeded to send and cancel Orders with Mql5. For canceling I used Order ticket as in one sample. Trouble is that in "Trade" tab Order changes itself its status. Before change there exists ticket number (in "Trade" tab that ticket header is called "Order", ticket number is 1010733541) and "Type" is "buy limit", but after that anomalian change ticket number is lost and "Type" is changed to "buy". Because my program recognizes order via ticket number therefore it is unable to cancel that order afterward. Is it somehow possible that Order status stays unchanged?
Before anomaly:
After anomaly:
Thank you!!!