add new tick to Renko chart

 

Hello
I have a Renko chart whose candlestick times are based on the first price tick that plays a role in its creation.
I have problems adding the last new tick to the chart. Because the time of the Renko candle is different from the time of the online candle, I have to change the time of the last tick myself so that the tick is placed on the live Renko candle.
 But apparently it doesn't work and it shows an extra candle on the chart whose time is equal to the time candle online or the downloaded time tick.
The code that adds a tick on the chart is:

   CustomRatesUpdate(symbol,rates);


   MqlTick tick[];
   CopyTicks(_Symbol,tick,COPY_TICKS_ALL,0,1);
   tick[0].time=rates[numCandle].time;
   CustomTicksAdd(symbol,tick);
 
please help me i need it