How can I Close an untriggered Pending-order based on time..

Back to topics list To post a new topic, please log in or register
avatar
2
kennied5010 2013.08.14 15:24
 

Hie Guys,

May anyone help, I would like to code a Line that Closes/Deletes a Pending order,

if not triggered, after a certain period of time (say 20 seconds). I have inserted question marks (?????)

in the code below, indicating where I would like to insert the line.

//-----

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderSymbol() == symbol && OrderMagicNumber()==Magicbuy)

{

if ( ???????????) // checks if 20 seconds has elapsed since opening order.....

{

OrderDelete(order_ticket);

return(0);

}

//-----

Thank you...

 
avatar
14167
RaptorUK 2013.08.14 15:42 #
 
080781:

Hie Guys,

May anyone help, I would like to code a Line that Closes/Deletes a Pending order,

if not triggered, after a certain period of time (say 20 seconds). I have inserted question marks (?????)

in the code below, indicating where I would like to insert the line.

<CODE REMOVED>

Please read some other posts before posting . . .

Please edit your post . . . please use the SRC button to post code: How to use the SRC button.


 
avatar
14167
RaptorUK 2013.08.14 15:45 #
 
080781:

Hie Guys,

May anyone help, I would like to code a Line that Closes/Deletes a Pending order,

if not triggered, after a certain period of time (say 20 seconds). I have inserted question marks (?????)

in the code below, indicating where I would like to insert the line.

Check it's OrderType() to make sure it is a pending order that you are going to try and close . . . then check it's OrderOpenTime() against TimeCurrent() . . . 20 seconds is too short, sometimes there can be no ticks for more than 20 seconds, what then ?

 
avatar
12985
WHRoeder 2013.08.14 16:42 #
 
and how far do you think the market moves is 20 seconds? You can't place a pending order too close to the market.
 
Back to topics list  

To add comments, please log in or register