Candlesticks stops plotting based on MqlTick when i update MqlRates

 

I have an operation custom symbol which is "XYZ"

the code to feed data is  :

MqlTick tick[1];

ArrayResize(tick, size);

tick[0].ask = Value1;
tick[0].bid = Value2;

int ReplaceTick=CustomTicksAdd(ymbol,tick);

now ticks are plotting candlesticks on chart using MqlTick tick

but when i try to start loading history on chart with this code

MqlRates rates[];
ArrayResize(rates, size);
int i=0;
   for(i; i< size; i++)
     {
      rates[i].open = NormalizeDouble(openrates,_Digits);
      rates[i].high = NormalizeDouble(highrates,_Digits);
      rates[i].low  = NormalizeDouble(lowrates,_Digits);
      rates[i].close= NormalizeDouble(closerates,_Digits);
      rates[i].time=ratestime;
     }

   if(i>0)
      CustomRatesReplace(symbol,rates[0].time,rates[size-1].time,rates);

the Ticks stops plotting candlesticks, but they show Bid line movement on chart and also Bid Ask Values on marketwatch

How can i fix this so after loading historical rates to chart, Ticks won't stop plotting latest candlesticks?

Thanks