expiration for pending order

 

Hi,


I want to place a pending order that will expire within 5 minutes (from the placement of the stop order).


Ticket=OrderSend(Symbol(),OP_BUYSTOP,Lot,StopPrice,Slippage,0,0,"OrderSend function",0001,here I must put the expiration,Blue); // Order send


I'm having difficulties with how to fill the field for expiration, I know it must be a datetime variable.


Thanks

 
mql4writer01:


I'm having difficulties with how to fill the field for expiration, I know it must be a datetime variable.

You tell it when you want the order to expire . . . so if the time now is TimeCurrent() add on 5 mins (5 * 60) and use that. It may well be rejected as being too close to the current time . . . if it fails check the error message.
 
RaptorUK:
It may well be rejected as being too close to the current time . . . if it fails check the error message.
There is also ERR_TRADE_EXPIRATION_DENIED some brokers don't allow it.