can't feed the custom symbol

 

Hello everyone.

I'm trying to create a custom symbol and feed it with custom data that i download from API.

I have created an array of MqlRates and put the downloaded data into the array. everything is ok so far, i check the array and all the values are correct. i use CustomRatesUpdate function to bind MqlRates array to my symbol, i check the output of function and it shows all the array updated successfully.

but after that i use ChartOpen function to open the chart of my symbol, and it shows "Waiting for update". also i use CopyRates function and another MqlRates array to get history data of my symbol and the result is -1.

here is my code:


void OnStart()
  {
  string symbol = "BTCUSD";
  bool isCustom;
  if(!SymbolExist(symbol, isCustom))
    CustomSymbolCreate(symbol,"Crypto");
  else
    Alert("Symbol exist");
  GetCandleData(symbol, "1h");          //function that download data from API
  
  MqlRates priceInfo[50];
  int result = CopyRates(symbol, PERIOD_H1, 0, 30, priceInfo);
  }

void GetCandleData(string symbol, string interval, long startTime = 0, long endTime = 0)
  {
  *
  *codes that download data from api
  *
  
  MqlRates rates[];
  ArrayResize(rates, candleIndex + 1);
  for(int i=0;i<=candleIndex;i++)
    {
    rates[i].time = mr[i].time;
    rates[i].open = NormalizeDouble(mr[i].open, 8);
    rates[i].high = NormalizeDouble(mr[i].high, 8);
    rates[i].low = NormalizeDouble(mr[i].low, 8);
    rates[i].close = NormalizeDouble(mr[i].close, 8);
    rates[i].real_volume = mr[i].real_volume;
    rates[i].spread = 0;
    rates[i].tick_volume = 0;
    }
  int result = CustomRatesUpdate(symbol, rates);
  Alert("number of updated rates: " + result);
  ChartOpen(symbol, PERIOD_H1);
  
  return;
  }

Can anyone tell my what is wrong?

 
I have the same issue, did you ever figure out a solution?
Reason: