Sidechair

label.* constants

Browse the reference

Label shapes for label.new: speech-bubble pointers in every direction, plus arrows, circles, flags and plain-text styles.

Try it in the editor

label.style_* constants go in the style argument of label.new and label.set_style. The label_* styles are text bubbles with a pointer: label.style_label_up points up at the bar, label.style_label_down (the default) points down, and label_left, label_right, label_center, label_upper_left, label_upper_right, label_lower_left and label_lower_right place the pointer at that side or corner.

The shape styles (arrowup, arrowdown, triangleup, triangledown, circle, cross, xcross, diamond, flag, square) draw a marker instead of a bubble, with the text beside it. label.style_none draws only the text on no background, and label.style_text_outline draws text with an outline in the label colour.

Constants

NameValueDescription
label.style_arrowdownA downward arrow marker.
label.style_arrowupAn upward arrow marker.
label.style_circleA circle marker.
label.style_crossA plus-shaped cross marker.
label.style_diamondA diamond marker.
label.style_flagA flag marker.
label.style_label_centerA text bubble centred on the point, with no pointer.
label.style_label_downA text bubble with its pointer facing down; the default.
label.style_label_leftA text bubble with its pointer on the left side.
label.style_label_lower_leftA text bubble with its pointer at the lower-left corner.
label.style_label_lower_rightA text bubble with its pointer at the lower-right corner.
label.style_label_rightA text bubble with its pointer on the right side.
label.style_label_upA text bubble with its pointer facing up.
label.style_label_upper_leftA text bubble with its pointer at the upper-left corner.
label.style_label_upper_rightA text bubble with its pointer at the upper-right corner.
label.style_noneText only, with no bubble or marker.
label.style_squareA square marker.
label.style_text_outlineText with an outline in the label colour, and no bubble.
label.style_triangledownA downward-pointing triangle marker.
label.style_triangleupAn upward-pointing triangle marker.
label.style_xcrossAn x-shaped cross marker.

Remarks

  • The label's color argument is the bubble or marker colour; textcolor is the text. For label.style_none and label.style_text_outline the text takes its colour from textcolor.
  • A pointer style sits relative to the label's y coordinate: label.style_label_down puts the bubble above the point, label.style_label_up puts it below.

Example

Pine ScriptHighs and lowsOpen in editor
//@version=6
indicator("Pivot labels", overlay = true)
ph = ta.pivothigh(high, 5, 5)
pl = ta.pivotlow(low, 5, 5)
if not na(ph)
    label.new(bar_index - 5, ph, str.tostring(ph, "#.##"), style = label.style_label_down, color = color.red, textcolor = color.white)
if not na(pl)
    label.new(bar_index - 5, pl, str.tostring(pl, "#.##"), style = label.style_label_up, color = color.green, textcolor = color.white)

See also

Runs on Sidechair