What a tick starts from
Before each run on the forming bar the chart restores the state of the last confirmed bar:- series history (
x[1]) andtalibstate have not advanced; staticvariables have the value committed at the last close (see Values that persist across bars);- drawings are those of the last confirmed bar, so a label made on an earlier tick of this bar is gone;
- only
intravariables keep what the previous tick left.
barstate.isconfirmed true and that result is committed.
The barstate variables
All arebool series values.
A signal built on the
close of a forming bar can switch on and off as the price moves; guard it with barstate.isconfirmed:
calc_on_every_tick
The argument ofindicator() and strategy() decides whether the forming bar runs at all before it closes.
calc_on_every_tick does not change history: every closed bar runs once, plus a rerun after each fill in a strategy with calc_on_order_fills=true. alert() fires at most once per bar and only on live bars.