Functions
label.new()
Creates a label at (x, y) with optional text, color, and style.
Syntax
label.new(series int x, series float y, series string text, series string xloc, series string yloc, series color color, series string style, series color textcolor, series string size, series string textalign, series string tooltip, series string text_font_family, const bool force_overlay, series string text_formatting) → series label
Arguments
x required series int X-coordinate (bar index or time, depending on xloc). y required series float Y-coordinate (price). text series string Label text. Optional. xloc series string xloc.bar_index or xloc.bar_time. Default is bar_index. yloc series string Vertical location relative to the bar (yloc.price, etc.). Optional. color series color Label background color. Optional. style series string Label style (label.style_*). Optional. textcolor series color Text color. Optional. size series string Label size (size.tiny … size.huge). Optional. textalign series string Text alignment. Optional. tooltip series string Tooltip text shown on hover. Optional. text_font_family series string Font family. Optional. force_overlay const bool If true, draw on the main pane even when the script is not overlay. Default is false. text_formatting series string Text formatting (none, bold, italic). Optional. Return Type
series label Example
//@lipi=2
indicator("label.new Example", overlay=true)
if barstate.islast {
label.new(bar_index, high, text="High", color=color.green, style=label.style_label_down, textcolor=color.white)
}