Each section below gives the Lipi construct first, then the construct in each language, with a note wherever behaviour differs. The language name links to the documentation the row was checked against.
Value on an earlier bar
Reading what a series was a given number of bars ago. In Lipi this is written with the language’s own syntax. x[n] needs 0 <= n <= 500. A negative literal is a compile error; a computed bad index stops the script. Arrays use array.get.Bar number
The position of the current bar, counted from the first bar the script sees. In Lipi:bar_index. An int series, 0 on the first bar the script receives.
Last bar
Identifying the most recent bar of the chart. In Lipi:last_bar_index, barstate.islast. barstate.islast is true on the last loaded bar and on every realtime run; last_bar_index is that bar’s index.
How far back a script can read
The largest number of bars a script may reference in the past. In Lipi this is written with the language’s own syntax. Reach is 0 to 500 bars. A longer offset or length compiles, then stops the script; ema-family lengths above 500 fail on Add to chart.History functions on every bar
Functions that keep their own history give correct results only when called on every bar, not inside a branch that skips bars. In Lipi:ta.sma, ta.ema. A talib call in a skipped if branch, an unchosen ?: side or a sometimes-called function is computed over its own calls, not bars.
Keep a value across bars
A variable that is set once and keeps its value from bar to bar until the script changes it. In Lipi:static. Committed when the bar closes. Each tick of a forming bar restarts from the saved value, so a push per tick adds once per bar.
Keep a value across live updates
A variable that also keeps its value between updates of the same live bar. In Lipi:intra. intra is cleared when the bar closes. On history, with one run per bar, it behaves like an ordinary variable.
Bar state flags
True/false values that tell the script whether the bar is the first, historical, live, new or closed. In Lipi:barstate.isfirst, barstate.ishistory, barstate.isrealtime, barstate.isnew, barstate.isconfirmed, barstate.islastconfirmedhistory. barstate.isnew is true on every history bar. isconfirmed is false on the last history bar while the market is open.