check if pending order has opened

 

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

 
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.)
 

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.

 

similar discussion here with some code

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

V

 

thanks guys... i appreciate the help

T

 
Comments that do not relate to this topic, have been moved to "Displaying current trades [MT5]".