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.
- www.mql5.com
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...
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
- www.mql5.com
I am a bit surprised that Metaquotes that should try to promote strongly their new version doesn't answer on such questions
- www.mql5.com
- 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 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);