line - Pine Script Variable
Overview
Section titled “Overview”Collections of line drawings created by your script.
Fields
Section titled “Fields”| Field | Type | Description |
|---|---|---|
line.all | array<line> | Returns an array filled with all the current lines drawn by the script. |
Remarks
Section titled “Remarks”line.all: The array is read-only. Index zero of the array is the ID of the oldest object on the chart.
Example
Section titled “Example”//@version=6indicator("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))