Sidechair

line.all

Browse the reference

Holds every line still on the chart as an array, oldest first, rebuilt on each read.

Try it in the editor

Loop over it to restyle or delete lines in bulk, including lines whose variables went out of scope. The array never holds more lines than max_lines_count allows.

Taking an item out of the array does not remove the drawing; call line.delete() on it. A line deleted that way is missing from the next read.

Type

array<line>

Remarks

  • On Sidechair: every use of line.all builds a fresh array from the lines currently on the chart, in creation order, so the first item is the oldest line and array.last() is the newest.

Example

Pine ScriptColor the newest line red on the last barOpen in editor
//@version=6
indicator("line.all: newest line", overlay = true)
if bar_index % 15 == 0
    line.new(bar_index, low, bar_index + 10, high, color = color.gray)
if barstate.islast
    line.set_color(array.last(line.all), color.red)

See also

Runs on Sidechair