Variables
barstate.isnew
The bar being evaluated is a new bar. Where it is not, your script reads false. Read it in a condition, as you would any series value: the answer it gives changes from bar to bar.
Example
indicator("BarState.new Example", overlay=false)
// Create a signal that is 1 when a new bar forms, otherwise 0
new_bar_signal = ta.change(bar_index) ? 1 : 0
// Plot the signal to visualize new bar formations
plot(new_bar_signal, color=color.green, style=plotStyle.histogram, title="New Bar Signal")
Type
series bool