Skip to main content
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 as l.<name>(...), for example l.set_text("u").
Example

label.all (function)

Definition Returns the array of all existing label objects (same as label.all). Syntax
Returns series array<label> An array of label IDs, oldest to newest. Example

label.copy (function)

Definition Creates a copy of a label. Syntax
Parameters Returns series label The new label ID. Example

label.delete (function)

Definition Deletes a label. Syntax
Parameters Returns void void Example

label.get_text (function)

Definition Returns a label’s text. Syntax
Parameters Returns series string The label text. Example

label.get_x (function)

Definition Returns a label’s x-coordinate. Syntax
Parameters Returns series int X-coordinate. Example

label.get_y (function)

Definition Returns a label’s y-coordinate (price). Syntax
Parameters Returns series float Y-coordinate. Example

label.new (function)

Definition Creates a label at (x, y) with optional text, color, and style. Syntax
Parameters Returns series label The ID of the created label. Notes
  • The size argument takes a size.* 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”.
Example

label.set_color (function)

Definition Sets a label’s background color. Syntax
Parameters Returns void void Example

label.set_point (function)

Definition Sets a label’s position from a chartPoint. Syntax
Parameters Returns void void Example

label.set_size (function)

Definition Sets a label’s size. Syntax
Parameters Returns void void Notes
  • The size argument takes a size.* 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.
Example

label.set_style (function)

Definition Sets a label’s style (label.style_*). Syntax
Parameters Returns void void Example

label.set_text (function)

Definition Sets a label’s text. Syntax
Parameters Returns void void Example

label.set_text_font_family (function)

Definition Sets a label’s font family. Syntax
Parameters Returns void void Example

label.set_text_formatting (function)

Definition Sets a label’s text formatting. Syntax
Parameters Returns void void Example

label.set_textalign (function)

Definition Sets a label’s text alignment. Syntax
Parameters Returns void void Example

label.set_textcolor (function)

Definition Sets a label’s text color. Syntax
Parameters Returns void void Example

label.set_tooltip (function)

Definition Sets a label’s tooltip. Syntax
Parameters Returns void void Example

label.set_x (function)

Definition Sets a label’s x-coordinate. Syntax
Parameters Returns void void Example

label.set_xloc (function)

Definition Sets whether a label’s x-coordinate is a bar index or time. Syntax
Parameters Returns void void Example

label.set_xy (function)

Definition Sets a label’s x and y coordinates. Syntax
Parameters Returns void void Example

label.set_y (function)

Definition Sets a label’s y-coordinate (price). Syntax
Parameters Returns void void Example

label.set_yloc (function)

Definition Sets a label’s vertical location relative to the bar. Syntax
Parameters Returns void void Example