Sidechair

plotshape()

Browse the reference

Marks bars with a symbol such as a triangle, label or cross, drawn where a condition is true or at an absolute price.

Try it in the editor

plotshape draws a shape on each bar where series is true or non-zero. For the default placements the shape sits above or below the bar; with location.absolute it sits at the series value itself.

Style, location, size and title come from the first bar the call runs on. Color and text color can change on every bar. The shape styles are the shape.* constants: arrowup, arrowdown, circle, cross, diamond, flag, labeldown, labelup, square, triangledown, triangleup and xcross.

Syntax

Pine Script
plotshape(series: series int/float/bool, title: const string (optional), style: input string (optional), location: input string (optional), color: series color (optional), offset: simple int (optional), text: const string (optional), textcolor: series color (optional), editable: input bool (optional), size: const string (optional), show_last: input int (optional), display: input plot_display (optional), format: input string (optional), precision: input int (optional), force_overlay: const bool (optional)) -> void

Arguments

NameTypeDefaultDescription
seriesseries int/float/boolrequiredA bool or number. Where it is true or non-zero the shape is drawn. With location.absolute it is the price level.
titleconst string"Shape"Name shown in the legend and Data Window.
styleinput stringshape.xcrossShape drawn, a shape.* constant.
locationinput stringlocation.abovebarPlacement, a location.* constant: abovebar, belowbar, top, bottom or absolute.
colorseries color#2962FFShape color, evaluated per bar.
offsetsimple int0Shifts the shapes by this many bars; negative moves them into the past.
textconst string""Text drawn with each shape.
textcolorseries colornaColor of the text, evaluated per bar.
editableinput booltrueAccepted for compatibility and ignored.
sizeconst stringsize.autoShape size, a size.* constant: auto, tiny, small, normal, large or huge.
show_lastinput intnaAccepted for compatibility and ignored.
displayinput plot_displaydisplay.allWhere the shapes are shown. display.none hides them from the chart.
formatinput stringformat.inheritAccepted for compatibility and ignored.
precisioninput intnaAccepted for compatibility and ignored.
force_overlayconst boolfalseWhen true, draws on the main chart pane even if the script runs in its own pane.

Returns

Nothing.

Remarks

  • On Sidechair: show_last, format and precision are accepted and ignored. In a pane of its own, abovebar and belowbar place shapes at the top and bottom edge of the pane, because that pane has no bars of price to sit on.
  • A series that is na or 0 draws nothing, so a numeric series such as a count marks every bar where it is non-zero.

Example

Pine ScriptTriangles on a swingOpen in editor
//@version=6
indicator("Shape markers", overlay = true)
up = ta.crossover(close, ta.sma(close, 20))
down = ta.crossunder(close, ta.sma(close, 20))
plotshape(up, "Up", shape.triangleup, location.belowbar, color.green, size = size.small)
plotshape(down, "Down", shape.triangledown, location.abovebar, color.red, size = size.small)

See also

Runs on Sidechair