Skip to content
Algo Trade Analytics Docs

[] - Pine Script Operator

[]

Series subscript. Provides access to previous values of series expr1. expr2 is the number of bars back, and must be numerical. Floats will be rounded down.

expr1[expr2]

A series of values.

//@version=6indicator("[]")// [] can be used to "save" variable value between barsa = 0.0 // declare `a`a := a[1] // immediately set current value to the same as previous. `na` in the beginning of historyif high == low // if some condition - change `a` value to another    a := lowplot(a)