Skip to content
Algo Trade Analytics Docs

label - Pine Script Variable

Collections of label drawings created by your script.

FieldTypeDescription
label.allarray<label>Returns an array filled with all the current labels drawn by the script.
  • label.all: The array is read-only. Index zero of the array is the ID of the oldest object on the chart.
//@version=6
indicator("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))