label - Pine Script Variable
Overview
Section titled “Overview”Collections of label drawings created by your script.
Fields
Section titled “Fields”| Field | Type | Description |
|---|---|---|
label.all | array<label> | Returns an array filled with all the current labels drawn by the script. |
Remarks
Section titled “Remarks”label.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("Label cleanup", overlay=true, max_labels_count=5)
if barstate.isfirst label.new(bar_index, high, "Hello", style=label.style_label_down)
if barstate.islast labels = label.all if array.size(labels) > 0 for i = 0 to array.size(labels) - 1 label.delete(array.get(labels, i))