Skip to content

Label

Handle for a label drawing.

Static Methods

new

Creates a label object on the chart.

Parameters

NameTypeDefaultDescription
pointseries chart.PointThe chart.Point object specifying the position of the label.
textseries StringnaThe text to display on the label.
xlocseries XLocXLoc.BarIndexThe x-location type: XLoc.BarIndex or XLoc.BarTime.
ylocseries YLocYLoc.PriceThe y-location type: YLoc.Price or YLoc.Price_range.
colorseries ColornaThe background color of the label.
styleseries LabelStyleLabelStyle.DownThe style of the label.
text_colorseries ColornaThe color of the label text.
sizeseries SizeSize.NormalThe size of the label as a named constant.
text_alignseries TextHAlignTextHAlign.CenterThe text alignment: TextHAlign.Center, TextHAlign.Left, or TextHAlign.Right.
tooltipseries StringnaThe tooltip text when hovering over the label.
text_font_familyseries FontFamilyFontFamily.DefaultThe font family for the label text.
force_overlayconst boolfalseIf true, the label is rendered on the top.
text_formattingconst TextFormatTextFormat.NONEThe text formatting options.

Returns: series Label

Creates a label object on the chart.

Parameters

NameTypeDefaultDescription
pointseries chart.PointThe chart.Point object specifying the position of the label.
textseries StringnaThe text to display on the label.
xlocseries XLocXLoc.BarIndexThe x-location type: XLoc.BarIndex or XLoc.BarTime.
ylocseries YLocYLoc.PriceThe y-location type: YLoc.Price or YLoc.Price_range.
colorseries ColornaThe background color of the label.
styleseries LabelStyleLabelStyle.DownThe style of the label.
text_colorseries ColornaThe color of the label text.
sizeseries int0The size of the label as an integer value.
text_alignseries TextHAlignTextHAlign.CenterThe text alignment: TextHAlign.Center, TextHAlign.Left, or TextHAlign.Right.
tooltipseries StringnaThe tooltip text when hovering over the label.
text_font_familyseries FontFamilyFontFamily.DefaultThe font family for the label text.
force_overlayconst boolfalseIf true, the label is rendered on the top.
text_formattingconst TextFormatTextFormat.NONEThe text formatting options.

Returns: series Label

Creates a label object on the chart.

Parameters

NameTypeDefaultDescription
xseries intThe x-coordinate (bar index or UNIX time).
yseries floatThe y-coordinate (price).
textseries StringnaThe text to display on the label.
xlocseries XLocXLoc.BarIndexThe x-location type: XLoc.BarIndex or XLoc.BarTime.
ylocseries YLocYLoc.PriceThe y-location type: YLoc.Price or YLoc.Price_range.
colorseries ColornaThe background color of the label.
styleseries LabelStyleLabelStyle.DownThe style of the label.
text_colorseries ColornaThe color of the label text.
sizeseries SizeSize.NormalThe size of the label as a named constant.
text_alignseries TextHAlignTextHAlign.CenterThe text alignment: TextHAlign.Center, TextHAlign.Left, or TextHAlign.Right.
tooltipseries StringnaThe tooltip text when hovering over the label.
text_font_familyseries FontFamilyFontFamily.DefaultThe font family for the label text.
force_overlayconst boolfalseIf true, the label is rendered on the top.
text_formattingconst TextFormatTextFormat.NONEThe text formatting options.

Returns: series Label

Creates a label object on the chart.

Parameters

NameTypeDefaultDescription
xseries intThe x-coordinate (bar index or UNIX time).
yseries floatThe y-coordinate (price).
textseries StringnaThe text to display on the label.
xlocseries XLocXLoc.BarIndexThe x-location type: XLoc.BarIndex or XLoc.BarTime.
ylocseries YLocYLoc.PriceThe y-location type: YLoc.Price or YLoc.Price_range.
colorseries ColornaThe background color of the label.
styleseries LabelStyleLabelStyle.DownThe style of the label.
text_colorseries ColornaThe color of the label text.
sizeseries int0The size of the label as an integer value.
text_alignseries TextHAlignTextHAlign.CenterThe text alignment: TextHAlign.Center, TextHAlign.Left, or TextHAlign.Right.
tooltipseries StringnaThe tooltip text when hovering over the label.
text_font_familyseries FontFamilyFontFamily.DefaultThe font family for the label text.
force_overlayseries boolfalseIf true, the label is rendered on the top.
text_formattingconst TextFormatTextFormat.NONEThe text formatting options.

Returns: series Label

Static Properties

all

Type: series Array<Label>

Returns an array filled with all the current labels drawn by the script.

Methods

copy

navi
copy(id: series Label): series Label

Creates a copy of the specified label and returns its id.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to copy.

Returns: series Label


delete

navi
delete(id: series Label)

Deletes the specified label from the chart.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to delete.

get_text

navi
get_text(id: series Label): series String

Returns text of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to get the text from.

Returns: series String


get_x

navi
get_x(id: series Label): series int

Returns UNIX time or bar index (depending on the last xloc value set) of this label's position.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to get the x-coordinate from.

Returns: series int


get_y

navi
get_y(id: series Label): series float

Returns price of this label's position.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to get the y-coordinate from.

Returns: series float


set_color

navi
set_color(id: series Label, color: series Color)

Sets color of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
colorseries ColorThe new background color.

set_point

navi
set_point(id: series Label, point: series chart.Point)

Sets the location of this label using a chart.Point object.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
pointseries chart.PointThe chart.Point object specifying the new position.

set_size

Sets arrow and text size of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
sizeseries intThe new size as an integer value.

Sets arrow and text size of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
sizeseries SizeThe new size as a named constant (Size.Tiny, Size.Small, Size.Normal, Size.Large, Size.Huge).

set_style

navi
set_style(id: series Label, style: series LabelStyle)

Sets style of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
styleseries LabelStyleThe new label style constant.

set_text

navi
set_text(id: series Label, text: series String)

Sets text of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
textseries StringThe new text to display.

set_text_align

navi
set_text_align(id: series Label, text_align: series TextHAlign)

Sets text alignment of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
text_alignseries TextHAlignThe text alignment: TextHAlign.Center, TextHAlign.Left, or TextHAlign.Right.

set_text_color

navi
set_text_color(id: series Label, text_color: series Color)

Sets text color of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
text_colorseries ColorThe new text color.

set_text_font_family

navi
set_text_font_family(id: series Label, text_font_family: series FontFamily)

Sets font family of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
text_font_familyseries FontFamilyThe font family: FontFamily.Default or FontFamily.Monospace.

set_text_formatting

navi
set_text_formatting(id: series Label, text_formatting: const TextFormat)

Sets text formatting of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
text_formattingconst TextFormatThe text formatting options.

set_tooltip

navi
set_tooltip(id: series Label, tooltip: series String)

Sets tooltip text of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
tooltipseries StringThe new tooltip text.

set_x

navi
set_x(id: series Label, x: series int)

Sets UNIX time or bar index (depending on the last xloc value set) of this label's position.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
xseries intThe new x-coordinate (bar index or UNIX time).

set_xloc

navi
set_xloc(id: series Label, xloc: series XLoc)

Sets x location type of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
xlocseries XLocThe x-location type: XLoc.BarIndex or XLoc.BarTime.

set_xy

navi
set_xy(id: series Label, x: series int, y: series float)

Sets both x and y coordinates of this label's position.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
xseries intThe new x-coordinate (bar index or UNIX time).
yseries floatThe new y-coordinate (price).

set_y

navi
set_y(id: series Label, y: series float)

Sets price of this label's position.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
yseries floatThe new y-coordinate (price).

set_yloc

navi
set_yloc(id: series Label, yloc: series YLoc)

Sets y location type of this label.

Parameters

NameTypeDefaultDescription
idseries LabelThe label to modify.
ylocseries YLocThe y-location type: YLoc.Price or YLoc.Price_range.