CopyRates doesn’t work properly

 

Hi guys, I have indicator with CopyRates function in OnInit. Something like that:

 

int OnInit() {

  MqlRates pairs[];

   int count = 0;

   

   ArraySetAsSeries(pairs, true);

   

   if (CopyRates(symbol, 0, 0, Bars, pairs) == -1 || ArraySize(pairs) < Bars) {

      Print ("Error: ", GetLastError(), " pairs count: ", ArraySize(pairs), " needed: ", Bars, " ", symbol);

      return -1;

   }

}

If I'm not wrong, then historical data should start downloading but it's not happen. I need exactly same number of indexes in pairs like I have in Bars. However terminal throws this in cycle:

Error: 0 pairs count: 11063 needed: 12212 AUDUSD

I will be thankful of any ideas!
 
My idea is trying to replace the Bars by iBars(symbol, 0).
 
DeepThought:
My idea is trying to replace the Bars by iBars(symbol, 0).
It's obviously he wants Bars from actual chart. It will be iBars(Symbol(), 0) but it's same story... maybe something with start datetime.
 
Just_Mike:
It's obviously he wants Bars from actual chart. It will be iBars(Symbol(), 0) but it's same story... maybe something with start datetime.

 

Then he probably hit the history limit. He must pick the lesser number of bars for both the symbol and Symbol(). But not sure if it has sense, the candles may not align.

 
Well I think he hasn't resized his array pairs. So he set an array with size = 0 as ..Series -  can't work :(
 
gooly:
Well I think he hasn't resized his array pairs. So he set an array with size = 0 as ..Series -  can't work :(
No, his problem is that he expects the CopyRates downloads data to the index he specified. But there are probably no more data at broker, 11k seems quite usual number for many of them, and many have even less.
Reason: