price slippage on pending order
- A pending order becomes a market order; there will be slippage.
- Remember the pending order price (perhaps a terminal variable) and compare to the opened price.
Dua Yong Rew:
is there any easy way to detect that the order executed price slipped from my pending order price?
#property script_show_inputs #include <MT4Orders.mqh> // https://www.mql5.com/en/code/16006 input long inTicket = 0; // Position Ticket #define PRINT(A) Print(#A + " = " + (string)(A)) void OnStart() { if (OrderSelect(inTicket, SELECT_BY_TICKET)) { OrderPrint(); PRINT(OrderOpenPrice()); PRINT(OrderOpenPriceRequest()); PRINT(OrderClosePrice()); PRINT(OrderClosePriceRequest()); PRINT(OrderTicketID()); } }
Result.
#3880043 2022.06.13 23:29:22.299 buy 0.03 USDCHF 0.99832 0.00000 0.99631 2022.06.14 04:02:44.569 0.99632 -0.12 -0.01 -6.02 4;[+5] 4 OrderOpenPrice() = 0.99832 OrderOpenPriceRequest() = 0.99837 OrderClosePrice() = 0.99632 OrderClosePriceRequest() = 0.99631 OrderTicketID() = 10965077
Or use the script CustomReport.
Thank you. This is very helpful

You are missing trading opportunities:
- Free trading apps
- Free Forex VPS for 24 hours
- 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
Hi all,
is there any easy way to detect that the order executed price slipped from my pending order price?