CopyHigh does not update history of lower timeframe

 

Hey,

right now i experience a really strange behavior in one of my EAs. I use the code below to calculate a range between two times. It is called in a funcion that is called in the OnTick(). I use the exact same EA on the EURUSD (5 min chart) and the USDJPY (1 min chart). When i start the EA everything works fine for that day (for both symbols). But the next day the EA attached to the 5 min EURUSD chart is unable to receive the 1 min history. The MT5 Terminal is running on a VPS so there is no interruption. The weird thing is that GetLastError() returns 0 on every tick. The USDJPY EA works fine on this day, too.

Did someone experience this before and is able to provide help? Would be highly appreciated.

Greetings, René 


   ResetLastError();
   double highs[], lows[];
   int resHigh = CopyHigh(_Symbol,PERIOD_M1,startTime,endTime,highs);
   int resLow = CopyLow(_Symbol,PERIOD_M1,startTime,endTime,lows);

   if(IsDebug){
      Print("res high: ",resHigh,", res low: ",resLow);
      Print("size highs: ",ArraySize(highs),", size lows: ",ArraySize(lows));
      Print("error is: ",GetLastError());
      Print("syncronized: ",SymbolIsSynchronized(_Symbol));
   }
   
   if(ArraySize(highs) <= 0 || ArraySize(lows) <= 0) return;

   rangeHigh = highs[ArrayMaximum(highs)];
   rangeLow = lows[ArrayMinimum(lows)];
   rangePoints = rangeHigh - rangeLow;

   if(IsDebug) Print("range high: ",rangeHigh,", range low: ",rangeLow);
 

Update: I managed to solve the problem with the CheckLoadHistory() function from this thread: https://www.mql5.com/en/docs/series/timeseries_access

But I still don't really understand the problem with my old code. The CopyHigh/CopyLow call should initiate the download and build process as it is written in the documentation. So on the next tick or the tick after ... there should be data available. That is pretty much the same thing that CheckLoadHistory() does, because it returned 2 in my case.

Maybe someone can help me here and provide an explanation. :)

Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access
Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access
  • www.mql5.com
Before price data become available in the MetaTrader 5 terminal, they must be received and processed. To receive data, connection to the MetaTrader 5 trade server must be established. Data are received in the form of packed blocks of minute bars from the server upon the request of a terminal. The mechanism of server reference for data doesn't...
Reason: