Download MetaTrader 5
To add comments, please log in or register
Find out how social trading can improve your profits
Simon Gniadkowski
Moderator
17975
Simon Gniadkowski 2012.01.12 11:45  
Did you read what error 147 means ?
whroeder1
13976
whroeder1 2012.01.12 12:45  
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?
qjol
3243
qjol 2012.01.12 13:15  

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

Route206
211
Route206 2015.10.24 06:58  
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. 

Uncl3B0B
29
Uncl3B0B 2015.10.26 12:20  
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
Keith Watford
Moderator
8872
Keith Watford 2015.10.26 12:42  
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 

Uncl3B0B
29
Uncl3B0B 2015.11.02 10:46  

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

/ /12
To add comments, please log in or register