How to Reference Historical Data

I’ve read through all the documentation and tutorials and I still can’t seem to wrap my head around how to access past bar data or past indicator values in a custom indicator via javascript. Can someone please help explain how historical data is accessed not only for OHLC data of previous bars but how can I access past data from an indicator? For instance, how can I see what the value(s) of a Bollinger Band indicator was 5 bars ago? Thank you.

I’m learning here also. I think the way this seems to work is the code is sent the candle informations on the screen from a certain point in time based on the view of the user. So you get a data stream from the engine that you start to process. You can “save” any of these candles into variables and work with them. So that’s your historical data.

What I’ve noticed with some of the indicators, like vwap, is that if you expand your chart, the vwap is recalculated. This confirms, in my mind, that the engine is recalculating all the candles because the new data changes the location of the vwap lines.

Does that help? Can anybody confirm my understanding or explain this better?