Label
Handle for a label drawing.
Static Methods
new
Creates a label object on the chart.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
point | series chart.Point | The chart.Point object specifying the position of the label. | |
text | series string | "" | The text to display on the label. |
xloc | series Xloc | Xloc.BarIndex | The x-location type: Xloc.BarIndex or Xloc.BarTime. |
yloc | series Yloc | Yloc.Price | The y-location type: Yloc.Price or Yloc.Price_range. |
color | series color | na | The background color of the label. |
style | series LabelStyle | LabelStyle.Down | The style of the label. |
text_color | series color | na | The color of the label text. |
size | series Size | Size.Normal | The size of the label as a named constant. |
textalign | series TextHAlign | TextHAlign.Center | The text alignment: TextHAlign.Center, TextHAlign.Left, or TextHAlign.Right. |
tooltip | series string | na | The tooltip text when hovering over the label. |
text_font_family | series FontFamily | FontFamily.Default | The font family for the label text. |
force_overlay | const bool | false | If true, the label is rendered on the top. |
text_formatting | const TextFormat | text.NONE | The text formatting options. |
Returns: series Label
Static Properties
all
Returns an array filled with all the current labels drawn by the script.
Methods
copy
Label.copy(id: series Label): series LabelCreates a copy of the specified label and returns its id.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to copy. |
Returns: series Label
delete
Label.delete(id: series Label)Deletes the specified label from the chart.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to delete. |
get_text
Label.get_text(id: series Label): series stringReturns text of this label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to get the text from. |
Returns: series string
get_x
Label.get_x(id: series Label): series intReturns UNIX time or bar index (depending on the last xloc value set) of this label's position.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to get the x-coordinate from. |
Returns: series int
get_y
Label.get_y(id: series Label): series floatReturns price of this label's position.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to get the y-coordinate from. |
Returns: series float
set_color
Label.set_color(id: series Label, color: series color)Sets color of this label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
color | series color | The new background color. |
set_point
Label.set_point(id: series Label, point: series chart.Point)Sets the location of this label using a chart.Point object.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
point | series chart.Point | The chart.Point object specifying the new position. |
set_size
Sets arrow and text size of this label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
size | series int | The new size as an integer value. |
set_style
Label.set_style(id: series Label, style: series LabelStyle)Sets style of this label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
style | series LabelStyle | The new label style constant. |
set_text
Label.set_text(id: series Label, text: series string)Sets text of this label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
text | series string | The new text to display. |
set_text_font_family
Label.set_text_font_family(
id: series Label,
text_font_family: series FontFamily
)Sets font family of this label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
text_font_family | series FontFamily | The font family: FontFamily.Default or FontFamily.Monospace. |
set_text_formatting
Label.set_text_formatting(id: series Label, text_formatting: const TextFormat)Sets text formatting of this label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
text_formatting | const TextFormat | The text formatting options. |
set_textalign
Label.set_textalign(id: series Label, textalign: series TextHAlign)Sets text alignment of this label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
textalign | series TextHAlign | The text alignment: TextHAlign.Center, TextHAlign.Left, or TextHAlign.Right. |
set_textcolor
Label.set_textcolor(id: series Label, text_color: series color)Sets text color of this label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
text_color | series color | The new text color. |
set_tooltip
Label.set_tooltip(id: series Label, tooltip: series string)Sets tooltip text of this label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
tooltip | series string | The new tooltip text. |
set_x
Label.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
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
x | series int | The new x-coordinate (bar index or UNIX time). |
set_xloc
Label.set_xloc(id: series Label, xloc: series Xloc)Sets x location type of this label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
xloc | series Xloc | The x-location type: Xloc.BarIndex or Xloc.BarTime. |
set_xy
Label.set_xy(id: series Label, x: series int, y: series float)Sets both x and y coordinates of this label's position.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
x | series int | The new x-coordinate (bar index or UNIX time). | |
y | series float | The new y-coordinate (price). |
set_y
Label.set_y(id: series Label, y: series float)Sets price of this label's position.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
y | series float | The new y-coordinate (price). |
set_yloc
Label.set_yloc(id: series Label, yloc: series Yloc)Sets y location type of this label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Label | The label to modify. | |
yloc | series Yloc | The y-location type: Yloc.Price or Yloc.Price_range. |