Download MetaTrader 5
To add comments, please log in or register
MQL5 Reference is available in 8 languages. Learn MQL5 in the language that suits you best!
Mohammad Ali
18104
Mohammad Ali 2014.02.19 09:28 

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
17963
Simon Gniadkowski 2014.02.19 09:35  
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