OP_BUYLIMIT Expiration Time - page 2

 
Did you read what error 147 means ?
 
wackena:
In this example, the expiration time is 0. I need example of pending order "Good for the Day Only".
  1. TimeCurrent()+84600 is an expiration good for 23.5 hours. It does not end at the end of the day.
    datetime now        = TimeCurrent(),
             bod        = now - now % 86400, // Beginning of the day
             tomorrow   = bod + 86400,
             expiration = tomorrow - 1;


  2. RaptorUK:
    Did you read what error 147 means ?
    Did you as Raptor asked?
 

as RaptorUK wrote

RaptorUK 2012.01.12 12:45

Did you read what error 147 means ?


ERR_TRADE_EXPIRATION_DENIED 147 Expirations are denied by broker.

so, call your broker

 
WHRoeder:
  1. datetime now        = TimeCurrent(),
             bod        = now - now % 86400, // Beginning of the day
             tomorrow   = bod + 86400,
             expiration = tomorrow - 1;

So simple and effective.. Great!

Thanks. 

 
When I cant set time for the expiration of pending order less than 600 second,  how to set it in EA? I need to close/delete pending order 1,2 or 3 minutes after entering. How to do it?
THX
 
Uncl3B0B:
When I cant set time for the expiration of pending order less than 600 second,  how to set it in EA? I need to close/delete pending order 1,2 or 3 minutes after entering. How to do it?
THX

Check that the OrderType() is not OP_BUY or OP_SELL ( that means that the order has not been triggered)

if TimeCurrent() -OrderOpenTime()>=nMinutes*60

Delete the order 

 

It works like this (so far :)

 

if (TimeCurrent() - OrderOpenTime()>=4*60)
  for(p = 0; p < OrdersTotal(); p++)
    {if (OrderSelect (p, SELECT_BY_POS, MODE_TRADES )&& OrderMagicNumber()==MN)
     {if (OrderType() == OP_BUYSTOP || OP_SELLSTOP) result =  OrderDelete(OrderTicket(),Yellow);} }

 THX

 
Uncl3B0B: It works like this (so far :)
if (OrderType() == OP_BUYSTOP || OP_SELLSTOP)

Nope. Zero is false, non-zero is true. (OrderType() == 4 || 5) equals  (OrderType() == 4 || true), and (anything or true) is always true.

if( 3 < 2 < 1 )
if( false < 1 )
if(     0 < 1 )
if(     true  )
if( 3 > 2 > 1 )
iftrue > 1 )
if(     1 > 1 )
if(     false )
Reason: