Download MetaTrader 5

Problem with expiration time pending order.

To add comments, please log in or register
Mohammad Ali
20002
Mohammad Ali  

Dear Guys

I am facing problem with expiration datetime of pending order. i try to set Expiration time only 60 seconds. It give me error :

"GBPUSD,Daily: Error opening BUY order! invalid trade parameters"

But when i set 900 seconds then it will work. What is the problem. don't i set any seconds.

    int Expiration=60;   
    datetime expire=0;
   if(Expiration>0)expire=TimeCurrent()+Expiration;

   ticket=OrderSend(Symbol(),type,lots,NormalizeDouble(price,Digits),20,sl,tp, TradeComment,MagicNumber,expire,clr);
Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
capilta:

Dear Guys

I am facing problem with expiration datetime of pending order. i try to set Expiration time only 60 seconds. It give me error :

"GBPUSD,Daily: Error opening BUY order! invalid trade parameters"

But when i set 900 seconds then it will work. What is the problem. don't i set any seconds.

The expiration is a datetime not an int, set a date and time not seconds. Some Brokers don't allow you to set an expiration . . .

The Forum search can also help you: https://www.mql5.com/en/forum/145063
To add comments, please log in or register