polyline - Pine Script Variable
polyline
Section titled “polyline”Overview
Section titled “Overview”Collections of polyline drawings created by your script.
Fields
Section titled “Fields”| Field | Type | Description |
|---|---|---|
polyline.all | array<polyline> | Returns an array containing all current polyline instances drawn by the script. |
Remarks
Section titled “Remarks”polyline.all: The array is read-only. Index zero of the array references the ID of the oldest polyline object on the chart.
Example
Section titled “Example”//@version=6indicator("Polyline cleanup", overlay=true, max_polylines_count=1)
if barstate.islast polylines = polyline.all if array.size(polylines) > 0 for i = 0 to array.size(polylines) - 1 polyline.delete(array.get(polylines, i))
points = array.new<chart.point>() array.push(points, chart.point.from_index(bar_index - 10, low)) array.push(points, chart.point.from_index(bar_index, high))
polyline.new(points, curved=false, closed=false, line_color=color.new(color.blue, 0))