I get this response when sending a pending order with ORDER_TIME_SPECIFIED expiration:
2013.03.18 00:26:10 - Error Sending Buy Stop: 4756 (invalid expiration)
2013.03.18 00:26:10 - Volume = 0.04 Entry = 1.30655 SL = 1.29068 TP = 1.32036 Bid/Ask = 1.29176/1.29182 Exp: 2013.03.18 00:30:00
Even though I check SYMBOL_EXPIRATION_MODE:
Am I missing anything else?
PS: If I switch to ORDER_TIME_GTC, order goes through without errors.
Can you show your code for order sending ?
Sure:
NewVolume = GetPositionSize(UpperEntry - UpperSL); if (!Trade.OrderOpen(_Symbol, order_type, NewVolume, 0, UpperEntry, UpperSL, UpperTP, type_time, expiration, "ChartPatternHelper")) { last_error = GetLastError(); Output("StopLevel = " + DoubleToString(StopLevel, 8)); Output("FreezeLevel = " + DoubleToString(FreezeLevel, 8)); Output("type_time = " + IntegerToString(type_time)); Output("Error Sending Buy " + order_type_string + ": " + IntegerToString(last_error) + " (" + Trade.ResultRetcodeDescription() + ")"); Output("Volume = " + DoubleToString(NewVolume, LotDigits) + " Entry = " + DoubleToString(UpperEntry, _Digits) + " SL = " + DoubleToString(UpperSL, _Digits) + " TP = " + DoubleToString(UpperTP, _Digits) + " Bid/Ask = " + DoubleToString(Bid, _Digits) + "/" + DoubleToString(Ask, _Digits) + " Exp: " + TimeToString(expiration, TIME_DATE|TIME_SECONDS)); }
![Get in touch with developers using Service Desk! Get in touch with developers using Service Desk!](/i/community/logo_mql5_small.png)
- www.mql5.com
I wonder if your expiration date is not too close to the current date. Try with 10 minutes at least.
hi enivid
i use this coding, it work
MqlTradeRequest Request; ZeroMemory(Request); Request.type_time= ORDER_TIME_SPECIFIED; Request.expiration = TimeCurrent()+PERIOD_M30*60;
hi enivid
i use this coding, it work
Thanks for suggestion! It turns out MetaQuotes removed the following line:
m_request.expiration = expiration;
From its OrderOpen() implementation in Trade.mqh standard library without removing expiration from the function's parameters. Pretty cruel bug.
![Documentation on MQL5: Standard Library Documentation on MQL5: Standard Library](/i/community/logo_mql5_small.png)
Thanks for suggestion! It turns out MetaQuotes removed the following line:
From its OrderOpen() implementation in Trade.mqh standard library without removing expiration from the function's parameters. Pretty cruel bug.
Could you report this bug to Service Desk ?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I get this response when sending a pending order with ORDER_TIME_SPECIFIED expiration:
2013.03.18 00:26:10 - Error Sending Buy Stop: 4756 (invalid expiration)
2013.03.18 00:26:10 - Volume = 0.04 Entry = 1.30655 SL = 1.29068 TP = 1.32036 Bid/Ask = 1.29176/1.29182 Exp: 2013.03.18 00:30:00
Even though I check SYMBOL_EXPIRATION_MODE:
Am I missing anything else?
PS: If I switch to ORDER_TIME_GTC, order goes through without errors.