# OP_BUYLIMIT Expiration Time - page 2

To add comments, please log in or register
Moderator
18050

Did you read what error 147 means ?
16763

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?
3245

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

211

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.

29

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
Moderator
10536

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

29

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

To add comments, please log in or register