Download MetaTrader 5

What's happening here? Is this a CopyRates bug?

To add comments, please log in or register
Bogdan Caramalac
Bogdan Caramalac  

I am having an issue while working on a correlation indicator; it reads USDCHF in the same time as EURUSD;


 Code excerpt:

   int startpos=prev_calculated+needed; //this is the start position ; it goes UPWARD, we are on an array, not on series  
   for (int pos=startpos;pos<rates_total;pos++) //main cycle, going from startpos to rates_total
         Print(pos," ",TimeToString(mqlrfinal[p-1].time,TIME_DATE)," -> ",DoubleToString(mqlrfinal[p-1].close,5));
      Print("last positions: ",lastFirst," ",lastSecond);

The loop is a bit larger, but the rest doesn't seem to be an issue. The task is simple: read a backward period of BarCount bars from EURUSD, get their start and end times, then read the same period from Overlay (USDCHF) (between dt0 and dt1). Also store the value corresponding to the dt1 bar on USDCHF.

 Now look at the "last positions" log lines. There are plenty of lines with normal time, USDCHF data, that is not read (lastSecond=-2) ; at the same time, there is no "WTF!" meaning that the last value , corresponding of the dt1-dt1 bar on USDCHF, is read. Now how can that happen? Doesn't read dt0 to dt1, but reads dt1 to dt1 ?  

Bogdan Caramalac
Bogdan Caramalac  

After last update, this doesn't do that anymore.

Now the CopyRates selection with two datetimes doesn't work anymore at all ; it works the regular selection by bars and the selection with one daytime and a bar count. 

To add comments, please log in or register