Actual Scenario: Assume have refresh the charts at 12:48pm, with 30m interval, got data upto 12:45pm from getBars and streaming subscribed then upto 12:59:59pm data updates on 12:45 candle.
when time reaches to 01:00 pm new candle plots here instead of 01:15pm. Observed it happens only at when Heikin Ashi selects.
Expected
How to implement streaming for Intraday(Minute data) and Historical data?
I Have implemented streaming using web socket data based on the [https://www.tradingview.com/charting-library-docs/latest/tutorials/implement_datafeed_tutorial/Streaming-Implementation/] but it suits only historical data, not working for Intraday.
Actual Scenario: Assume have refresh the charts at 12:48pm, with 30m interval, got data upto 12:45pm from getBars and streaming subscribed then upto 12:59:59pm data updates on 12:45 candle.
when time reaches to 01:00 pm new candle plots here instead of 01:15pm. Observed it happens only at when Heikin Ashi selects.
Expected How to implement streaming for Intraday(Minute data) and Historical data?
Note: We are not found any relevant example from official documentation. So, we are taken reference as [https://medium.com/@jonchurch/tv-part-2-b8c2d4211f90]
The below code is core logic for candle update
`function updateBar(streamResponse, sub) { var lastBar = sub.lastBar; let resolution = sub.resolution; if (resolution.includes('D')) { // 1 day in minutes === 1440 resolution = 1440 } else if (resolution.includes('W')) { // 1 week in minutes === 10080 resolution = 10080 } var coeff = resolution 60 1000; // console.log({coeff}) var rounded = Math.floor(streamResponse.tradeTime / coeff) * coeff; var lastBarSec = lastBar.time; var _lastBar;
}`