'Charting library goes off sync when there is a large depth in getbars callback and custom study

I encounter this bug in the datafeed requests of getBars. My setup is as follows:

  • main series request for instrument e.g. BTCUSDT
  • custom indicator for Index Price which I call .BTCUSDT. The aim is to show candle data history and a line tracking those candles plotted as a line series (the index). Everything works fine except in some weird cases where resolutions are changed back n forth and there is a considerable amount of "depth" scroll in the chart. The callback responsible for history data might at that point get out of sync and this uncaught error, time must be unique is thrown by the library. It happens in a method that aims to reconcile the timeseries due to the multiple patched up requests for data and somehow the fillIndexesInRows shows some form of index offset and the error happens. How can this be avoided? The backend is limited to a max of 2500 candles per request and it looks like the from/to timestamps for the main series do not match 1:1 with the from/to timestamps for the custom study.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source