Skip to content
Algo Trade Analytics Docs

line - Pine Script Variable

Collections of line drawings created by your script.

FieldTypeDescription
line.allarray<line>Returns an array filled with all the current lines drawn by the script.
  • line.all: The array is read-only. Index zero of the array is the ID of the oldest object on the chart.
//@version=6
indicator("Line cleanup", overlay=true, max_lines_count=5)
if barstate.isfirst
line.new(bar_index, close, bar_index + 10, close,
extend=extend.right, color=color.new(color.blue, 0))
if barstate.islast
lines = line.all
if array.size(lines) > 0
for i = 0 to array.size(lines) - 1
line.delete(array.get(lines, i))