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
ParameterTypeRequiredNotes
seriesseries boolyesThe condition. The mark appears where it holds.
titleconst stringnoConst-form, so it cannot be built from series data.
shapeinput shapenoA member of the shape set.
locationinput locationnoA member of the location set.
colorseries colornoSeries-form, so it may differ on every bar.
offsetinput intnoInput-form, so it cannot change from bar to bar.
textconst stringnoConst-form: one fixed string for every mark, not a per-bar value.
textcolorseries colornoSeries-form, so it may differ on every bar.
sizeinput sizenoA member of the size set.
force_overlayconst boolnoSets 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.

shapeMarkerWith text
shape.arrowdownthe arrowdown marker as the chart draws itthe arrowdown marker carrying its text
shape.arrowupthe arrowup marker as the chart draws itthe arrowup marker carrying its text
shape.circlethe circle marker as the chart draws itthe circle marker carrying its text
shape.crossthe cross marker as the chart draws itthe cross marker carrying its text
shape.diamondthe diamond marker as the chart draws itthe diamond marker carrying its text
shape.flagthe flag marker as the chart draws itthe flag marker carrying its text
shape.labeldownthe labeldown marker as the chart draws itthe labeldown marker carrying its text
shape.labelupthe labelup marker as the chart draws itthe labelup marker carrying its text
shape.squarethe square marker as the chart draws itthe square marker carrying its text
shape.triangledownthe triangledown marker as the chart draws itthe triangledown marker carrying its text
shape.triangleupthe triangleup marker as the chart draws itthe triangleup marker carrying its text
shape.xcrossthe xcross marker as the chart draws itthe xcross marker carrying its text

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) → void

plotchar 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
ParameterTypeRequiredNotes
seriesseries floatyesA number, not a condition.
titleconst stringnoConst-form, so it cannot be built from series data.
colorupseries colornoSeries-form, so it may differ on every bar.
colordownseries colornoSeries-form, so it may differ on every bar.
offsetinput intnoInput-form, so it cannot change from bar to bar.
minheightinput intnoInput-form, so it is fixed for the run of the script.
maxheightinput intnoInput-form, so it is fixed for the run of the script.
force_overlayconst boolnoSets 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.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade