Text and markers
Three functions put a mark on a bar rather than a line across the chart. plotshape draws a shape from a fixed set. plotchar draws a single character. plotarrow draws an arrow whose size follows from a number.
All three are chart-output functions, so all three must be called at the top level of the script, outside any branch, loop or function of your own. That is not a limitation on when a mark appears: the condition goes in the first argument, where the interpreter reads it once per bar.
Choosing between them
plotshape and plotchar take a condition. plotarrow takes a number. That difference decides which one you want.
If you know on which bars the mark belongs, use plotshape or plotchar and hand it the test. If the mark’s size should follow a measured value, use plotarrow and hand it the value.
plotshape
plotshape(series bool series, const string title, input shape shape, input location location, series color color, input int offset, const string text, series color textcolor, input size size, const bool force_overlay) → void| Parameter | Type | Required | Notes |
|---|---|---|---|
series | series bool | yes | The condition. The mark appears where it holds. |
title | const string | no | Const-form, so it cannot be built from series data. |
shape | input shape | no | A member of the shape set. |
location | input location | no | A member of the location set. |
color | series color | no | Series-form, so it may differ on every bar. |
offset | input int | no | Input-form, so it cannot change from bar to bar. |
text | const string | no | Const-form: one fixed string for every mark, not a per-bar value. |
textcolor | series color | no | Series-form, so it may differ on every bar. |
size | input size | no | A member of the size set. |
force_overlay | const bool | no | Sets this drawing’s overlay, separately from the script-wide setting. |
indicator("Up and down bars")
plot(close, title = "Close", color = color.gray)
plotshape(close > open, title = "Up", shape = shape.triangleup, location = location.belowbar, color = color.green, size = size.tiny)
plotshape(close < open, title = "Down", shape = shape.triangledown, location = location.abovebar, color = color.red, size = size.tiny)Note the shape of that example. Two calls, each at the top level, each carrying its own condition. Wrapping one call in a branch would be rejected.
The markers shape offers
Twelve markers, listed alphabetically. The second column is the marker on its own; the third is the same marker carrying the text you pass.
shape | Marker | With text |
|---|---|---|
shape.arrowdown | ![]() | ![]() |
shape.arrowup | ![]() | ![]() |
shape.circle | ![]() | ![]() |
shape.cross | ![]() | ![]() |
shape.diamond | ![]() | ![]() |
shape.flag | ![]() | ![]() |
shape.labeldown | ![]() | ![]() |
shape.labelup | ![]() | ![]() |
shape.square | ![]() | ![]() |
shape.triangledown | ![]() | ![]() |
shape.triangleup | ![]() | ![]() |
shape.xcross | ![]() | ![]() |
plotchar
plotchar(series bool series, const string title, const string char, input location location, series color color, input int offset, const string text, series color textcolor, input size size, const bool force_overlay) → voidplotchar takes the same parameters as plotshape, with one difference: char in place of shape. It is a const string rather than a member of a fixed set.
plotchar draws one character. If you pass a longer string it is cut to its first character, without a warning and without an error. Pass the one character you want.
plotarrow
plotarrow(series float series, const string title, series color colorup, series color colordown, input int offset, input int minheight, input int maxheight, const bool force_overlay) → void| Parameter | Type | Required | Notes |
|---|---|---|---|
series | series float | yes | A number, not a condition. |
title | const string | no | Const-form, so it cannot be built from series data. |
colorup | series color | no | Series-form, so it may differ on every bar. |
colordown | series color | no | Series-form, so it may differ on every bar. |
offset | input int | no | Input-form, so it cannot change from bar to bar. |
minheight | input int | no | Input-form, so it is fixed for the run of the script. |
maxheight | input int | no | Input-form, so it is fixed for the run of the script. |
force_overlay | const bool | no | Sets this drawing’s overlay, separately from the script-wide setting. |
plotarrow has no location, no shape, no size and no text. Where an arrow sits follows from the number you give it, and it takes an up colour and a down colour rather than one colour.
If you want to place a mark yourself, or label it, use plotshape or plotchar instead.























