SeriesInfoInteger and CopyTime halt!

 

Hi,

Sometimes, when I use SeriesInfoInteger and CopyTime in MQL5 for a symbol, my code halts for ever, and does not respond. How can I set a timeout so that if the program halts, for example, for 10 second, the task or the calling function is terminated? The symbol is included in the market watch window, but when I try to access to its chart in MetaTrader 5, the "waiting for update" message is displayed for a long time without any update. Here is my code:


int CheckLoadHistory(string symbol,ENUM_TIMEFRAMES period,datetime start_date)
  {
   datetime first_date=0;
   datetime times[100];
//--- check symbol & period
   if(symbol==NULL || symbol=="") symbol=Symbol();
   if(period==PERIOD_CURRENT)     period=Period();
//--- check if symbol is selected in the Market Watch
   if(!SymbolInfoInteger(symbol,SYMBOL_SELECT))
     {
      if(GetLastError()==ERR_MARKET_UNKNOWN_SYMBOL) return(-1);
      SymbolSelect(symbol,true);
     }

//--- check if data is present: ************* The code halts when running the following line for some symbols
   SeriesInfoInteger(symbol,period,SERIES_FIRSTDATE,first_date);
   if(first_date>0 && first_date<=start_date) return(1);
}


Thanks for your help.
 
Show your code and maybe somebody can help
 
hadipardis:

Hi,

Sometimes, when I use SeriesInfoInteger and CopyTime in MQL5 for a symbol, my code halts for ever, and does not respond. How can I set a timeout so that if the program halts, for example, for 10 second, the task or the calling function is terminated? The symbol is included in the market watch window, but when I try to access to its chart in MetaTrader 5, the "waiting for update" message is displayed for a long time without any update. Here is my code:



Thanks for your help.

Which broker, which symbol, how to reproduce it ?

Which MT5 Build ?