3.3 Updates of the current bar only
To make calculations faster and more efficient, the chart tells your UDI whether only the current bar has changed since the last calculation, in the data.currentBarUpdateOnly property.
Typically, if data.currentBarUpdateOnly is set, then you only need to re-calculate the final, most recent item in your output. If it is not set, then you need to re-calculate the whole series of output values from your indicator, because any part of the historic data may have changed.
The example code contains two versions of an SMA indicator: one which always re-calculates all values, and a more efficient one which uses data.currentBarUpdateOnly to update only the current average value if only the current bar is changing.
Last updated