Download MetaTrader 5

check if pending order has opened

To add comments, please log in or register
toriachtmql
67
toriachtmql  

Hi,

How can i check if a pending order has been triggered? I have two pending orders and want to cancel one if the other opens but can't see a method to check if the order has been triggered?

Thanks,

Tori

JC
1577
JC  
Toriacht:

How can i check if a pending order has been triggered? I have two pending orders and want to cancel one if the other opens but can't see a method to check if the order has been triggered?

Once a pending order has been triggered, its type changes to OP_BUY or OP_SELL - i.e. OP_BUYLIMIT and OP_BUYSTOP become OP_BUY; OP_SELLLIMIT AND OP_SELLSTOP become OP_SELL. The open time also gets changed from the time of placement to the time of fill. (Putting it another way, once a pending order has been filled, you can't tell from the MT4 order details alone whether it was originally a limit or a stop, and when it was placed rather than filled.)
fbj
1047
fbj  

use unique order magic number for every pending order when OrderSend().

if poll orders frequently, int OrderMagicNumber() will allow mapping the two orders. int OrderType() will give values according to current status as jjc details.

Viffer
614
Viffer  

similar discussion here with some code

https://www.mql5.com/en/forum/126575

V

toriachtmql
67
toriachtmql  

thanks guys... i appreciate the help

T

honest_knave
Moderator
2342
honest_knave  
Comments that do not relate to this topic, have been moved to "Displaying current trades [MT5]".
To add comments, please log in or register