Does expiration work for pending orders in backtester?

 

I make the following code for a pending order but then it seems that the order doesn't expire after 1 hour in the backtester

Any idea why?

         request.action=TRADE_ACTION_PENDING;
         request.magic=1234;
         request.symbol=_Symbol;
         request.volume=Lots;
         request.type=ORDER_TYPE_BUY_LIMIT;
         request.price=buy;
         request.sl=buySL;
         request.tp=buyTP;
         request.deviation=digits_adjust;
         request.type_filling=ORDER_FILLING_AON;
         request.type_time=ORDER_TIME_SPECIFIED;
         request.expiration=TimeCurrent()+60*60;
         success = OrderSend(request,result);


 
Don't have time to go in the details now as it is almost midnight in Poland and I have to get up early in the morning, but my first guess is that TimeCurrent() gets the last server time, not the time when you place the order in the backtester and that's why you don't get what you expect.
 
Enigma71fx:
Don't have time to go in the details now as it is almost midnight in Poland and I have to get up early in the morning, but my first guess is that TimeCurrent() gets the last server time, not the time when you place the order in the backtester and that's why you don't get what you expect.
For the backtester TimeCurrrent() should return the time corresponding to the "backtester time" not the actual current time otherwise it is a bug in MQL5
Documentation on MQL5: Date and Time / TimeCurrent
  • www.mql5.com
Date and Time / TimeCurrent - Documentation on MQL5
 

Well, maybe it should, but see what the manual says:

 

TimeCurrent

Returns the last known server time server, time of the last quote receipt for one of the symbols selected in the "Market Watch" window. In the OnTick() handler, this function returns the time of the received handled tick. In other cases (for example, call in handlers OnInit(), OnDeinit(), OnTimer() and so on) this is the time of the last quote receipt for any symbol available in the "Market Watch" window, the time shown in the title of this window. The time value is formed on a trade server and does not depend on the time settings on your computer. 

 
 
Code looks correct. The expiration should happen within 1 hour in tester time.... But there are fishy things about a lot of things in tester...
 
TheEconomist:
Code looks correct. The expiration should happen within 1 hour in tester time.... But there are fishy things about a lot of things in tester...

Yes as you say...

Specially according to my tests, several things related to pending orders and backtester are not working as they shoud. It works live but the backtester doesn't work properly.

I am a bit surprised that Metaquotes that should try to promote strongly their new version doesn't answer on such questions

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
 
jlpi:

I am a bit surprised that Metaquotes that should try to promote strongly their new version doesn't answer on such questions

Have you tried to post this error via Service Desk? I had 4 issues with MT5, posted all 4 of them using Service Desk and guys from Metaquotes have responded within 24 hours.
 
I don't have any inputs on https://www.mql5.com/en/forum/1926 ...
The messy OnTrade() on Strategy Tester
  • www.mql5.com
Selected deal ticket 1 having entry 0 in the HistorySelect queueHN 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.