The twelve marker shapes plotshape() can draw: arrows, triangles, circle, cross, diamond, flag, square, xcross and two label forms.
shape.* constants go in plotshape()'s style argument. The marker is placed by the location argument (location.abovebar, location.belowbar, location.top, location.bottom or location.absolute) and sized by size.* constants. shape.labelup and shape.labeldown draw a text bubble that holds the text argument; the other shapes show text next to the marker.
shape.xcross is plotshape's default style. The arrow shapes point in the direction in their name: shape.arrowup points up, so it usually belongs below the bar.
Constants
| Name | Value | Description |
|---|---|---|
shape.arrowdown | A downward arrow. | |
shape.arrowup | An upward arrow. | |
shape.circle | A filled circle. | |
shape.cross | A plus-shaped cross. | |
shape.diamond | A filled diamond. | |
shape.flag | A small flag. | |
shape.labeldown | A text bubble with its pointer facing down. | |
shape.labelup | A text bubble with its pointer facing up. | |
shape.square | A filled square. | |
shape.triangledown | A downward-pointing triangle. | |
shape.triangleup | An upward-pointing triangle. | |
shape.xcross | An x-shaped cross; plotshape's default. |
Remarks
- plotshape draws a marker on every bar where its series is true. Feed it a boolean condition to mark events; a plain number is not accepted in version 6, so write close > open rather than the price series itself.
- The shapes are fixed; for arbitrary text or a custom position, use
label.newinstead.
Examples
//@version=6
indicator("Cross markers", overlay = true)
fast = ta.sma(close, 10)
slow = ta.sma(close, 30)
plot(fast, "Fast", color.blue)
plot(slow, "Slow", color.orange)
plotshape(ta.crossover(fast, slow), "Up", shape.triangleup, location.belowbar, color.green, size = size.small)
plotshape(ta.crossunder(fast, slow), "Down", shape.triangledown, location.abovebar, color.red, size = size.small)//@version=6
indicator("Volume spikes", overlay = true)
spike = volume > ta.sma(volume, 20) * 2
plotshape(spike, "Spike", shape.diamond, location.abovebar, color.orange, size = size.tiny)See also
Runs on Sidechair