Language version: 2 · Reference version: 2.7 · Date: 2026-10-25 · Compiler build: df7b3b14 · Namespace: label · Entries: 23
label (library)
Definition
Functions for creating and mutating text label drawings on the chart.
Notes
- A
label.<name>(l, ...)function can also be called on the label asl.<name>(...), for examplel.set_text("u").
label.all (function)
Definition
Returns the array of all existing label objects (same as label.all).
Syntax
series array<label>
An array of label IDs, oldest to newest.
Example
label.copy (function)
Definition
Creates a copy of a label.
Syntax
Returns
series label
The new label ID.
Example
label.delete (function)
Definition
Deletes a label.
Syntax
Returns
void
void
Example
label.get_text (function)
Definition
Returns a label’s text.
Syntax
Returns
series string
The label text.
Example
label.get_x (function)
Definition
Returns a label’s x-coordinate.
Syntax
Returns
series int
X-coordinate.
Example
label.get_y (function)
Definition
Returns a label’s y-coordinate (price).
Syntax
Returns
series float
Y-coordinate.
Example
label.new (function)
Definition
Creates a label at (x, y) with optional text, color, and style.
Syntax
Returns
series label
The ID of the created label.
Notes
- The
sizeargument takes asize.*constant (size.auto,size.tiny,size.small,size.normal,size.large,size.huge). A string such as “small” still compiles, with a deprecation warning: write the constant. A string that is not a size name, such as “giant”, stops the compiler with the error “internal validator error”.
label.set_color (function)
Definition
Sets a label’s background color.
Syntax
Returns
void
void
Example
label.set_point (function)
Definition
Sets a label’s position from a chartPoint.
Syntax
Returns
void
void
Example
label.set_size (function)
Definition
Sets a label’s size.
Syntax
Returns
void
void
Notes
- The
sizeargument takes asize.*constant (size.auto,size.tiny,size.small,size.normal,size.large,size.huge). A string such as “small” still compiles, with a deprecation warning: write the constant.
label.set_style (function)
Definition
Sets a label’s style (label.style_*).
Syntax
Returns
void
void
Example
label.set_text (function)
Definition
Sets a label’s text.
Syntax
Returns
void
void
Example
label.set_text_font_family (function)
Definition
Sets a label’s font family.
Syntax
Returns
void
void
Example
label.set_text_formatting (function)
Definition
Sets a label’s text formatting.
Syntax
Returns
void
void
Example
label.set_textalign (function)
Definition
Sets a label’s text alignment.
Syntax
Returns
void
void
Example
label.set_textcolor (function)
Definition
Sets a label’s text color.
Syntax
Returns
void
void
Example
label.set_tooltip (function)
Definition
Sets a label’s tooltip.
Syntax
Returns
void
void
Example
label.set_x (function)
Definition
Sets a label’s x-coordinate.
Syntax
Returns
void
void
Example
label.set_xloc (function)
Definition
Sets whether a label’s x-coordinate is a bar index or time.
Syntax
Returns
void
void
Example
label.set_xy (function)
Definition
Sets a label’s x and y coordinates.
Syntax
Returns
void
void
Example
label.set_y (function)
Definition
Sets a label’s y-coordinate (price).
Syntax
Returns
void
void
Example
label.set_yloc (function)
Definition
Sets a label’s vertical location relative to the bar.
Syntax
Returns
void
void
Example