CustomRatesUpdate not working

 

Dear colleagues,

I'm trying to import some external data into MT5, but I'm having some difficulties with some functions, specially CustomRatesUpdate. I'm trying to do a simple test, but CustomRatesUpdate is returning -1, and _LastError is 0. Can anyone please help me? Thanks in advance.


void OnTimer()
{
   SymbolSelect(symbol,false);
   CustomSymbolDelete(symbol);
   CustomSymbolCreate(symbol);
   SymbolSelect(symbol,true);
   CustomSymbolSetDouble(symbol,SYMBOL_TRADE_TICK_SIZE,0.00000001);
   CustomSymbolSetInteger(symbol,SYMBOL_DIGITS,8);
   CustomSymbolSetSessionQuote(symbol,SUNDAY,0,0,24*60*60);
   CustomSymbolSetSessionQuote(symbol,SATURDAY,0,0,24*60*60);
   CustomSymbolSetSessionTrade(symbol,SUNDAY,0,0,24*60*60);
   CustomSymbolSetSessionTrade(symbol,SATURDAY,0,0,24*60*60);
   CustomSymbolSetInteger(symbol,SYMBOL_CHART_MODE,SYMBOL_CHART_MODE_LAST);
        
   MqlRates rates[3];
   rates[0].close = 50;
   rates[0].high = 51;
   rates[0].low = 49;
   rates[0].open = 49;
   rates[0].real_volume = 1;
   rates[0].spread = 1;
   rates[0].tick_volume = 1;
   rates[0].time = D'17.03.2020 12:30:00';
   
   rates[1].close = 50;
   rates[1].high = 51;
   rates[1].low = 49;
   rates[1].open = 49;
   rates[1].real_volume = 1;
   rates[1].spread = 1;
   rates[1].tick_volume = 1;
   rates[1].time = D'17.03.2020 12:31:00';
   
   rates[2].close = 50;
   rates[2].high = 51;
   rates[2].low = 49;
   rates[2].open = 49;
   rates[2].real_volume = 1;
   rates[2].spread = 1;
   rates[2].tick_volume = 1;
   rates[2].time = D'17.03.2020 12:32:00';

   int check_int = CustomRatesUpdate(symbol,rates,WHOLE_ARRAY);
   int error = GetLastError();
   Print(error);
}
Razão: