Pending Orders will not expires in Strategy tester

 

Hello,

I am using pending orders in my EA and need they expire today if not activated. but in strategy tester the pending orders will not expired and still remain pending orders in terminal tab.

What is the problem here ? how can be resolved ?

My code is as below.

void placeOrder(ENUM_ORDER_TYPE type,double volume, double price, double SL, double TP, int magic, int day)
  {
   MqlTradeRequest request= {};
   MqlTradeResult  result= {};
   request.action   =TRADE_ACTION_PENDING;
   request.symbol   =Symbol();
   request.type     =type;
   request.volume   =volume;
   request.price    = price;
   request.sl       = SL;
   request.tp       = TP;
   request.magic    = magic;
   request.type_filling=ORDER_FILLING_IOC;
   if(day == 0)
      request.type_time = ORDER_TIME_DAY;
   else if(day > 0)
      {
      request.type_time = ORDER_TIME_SPECIFIED_DAY;
      request.expiration = TimeCurrent() + day*PeriodSeconds(PERIOD_D1);             // Order will be expired after Days (Day * 24Hour * 3600second)
      Print("stoplimitorder place expiration time ",request.expiration);
      }   
//--- send the request
   if(!OrderSend(request,result))
      PrintFormat("OrderSend error %d",GetLastError());     // if unable to send the request, output the error code
  }
Improperly formatted code edited by moderator.
 

Improperly formatted code edited by moderator. Please always use the CODE button (Alt-S) when inserting code.

Code button in editor

 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 

thanks. I found out the problem. I used the test based on Daily Timeframe and so regret strategy tester was not able to expire the pending orders on he subject day. !!!! it was a bad bug in strategytester.

I have to use the test in lower timeframes like H4, then strategy tester expires orders on 2nd candle of H4 for next day. !!!!!!