Skip to content
Algo Trade Analytics Docs
Pine library page — review pending. This page is preserved for compatibility but is not part of the reviewed search index. Check the official Pine Script v6 reference before relying on its explanation, signature, or example.

label namespace

The label namespace provides functions to draw text annotations anchored to bar coordinates. Labels can display values, status messages, or tooltips. Each call returns a handle you can update or delete later.

FunctionPurpose
label.new(x, y, text, xloc, yloc, color, style, textcolor)Create a label at (x, y).
label.set_x(id, x) / label.set_y(id, y)Move an existing label.
label.set_text(id, text)Update the caption.
label.set_style(id, style)Change label shape (arrow, circle, none).
label.set_color(id, color) / label.set_bgcolor(id, color) / label.set_textcolor(id, color)Adjust colors.
label.delete(id)Remove the label.
//@version=6
indicator("Label namespace example", overlay=true)
var label info = na
if barstate.islast
price = close
if na(info)
info := label.new(bar_index, price,
text = "Close: " + str.tostring(price, format.mintick),
style = label.style_label_left,
textcolor = color.white,
bgcolor = color.new(color.blue, 70))
else
label.set_x(info, bar_index)
label.set_y(info, price)
label.set_text(info, "Close: " + str.tostring(price, format.mintick))