Skip to main content
plotshape and plotchar mark the bars where a condition is true and may carry a fixed text. Text that depends on the data (a price, a count) is a label.

Fixed text on a mark

text on plotshape and plotchar is a const string: the same text on every mark. textcolor may change by bar; size and location are input values. plotchar draws one char (a longer string is cut to its first character).
Text built from data is refused:
The compiler says: Cannot call plotshape with argument text=str.tostring(close). An argument of series string type was used but a const string is expected. The same holds for title, and for char on plotchar.

Text from data: label.new

label.new(x, y, text, xloc, yloc, color, style, textcolor, size, textalign, tooltip, text_font_family, force_overlay, text_formatting) puts a label at bar x and price y, with any string. A label is a drawing: it may be created inside if, loops and functions, and the oldest labels are removed past max_labels_count (see Lines, labels, boxes and polylines).
Label text is limited to 999 characters, and yloc is yloc.price, yloc.abovebar or yloc.belowbar. For a grid of values, see Tables.