Skip to main content
plotshape takes a condition as its first argument and marks the bars where it is true. To mark one bar, write a condition that is true on one bar.
bar_index is a series value, so comparing it with a number picks out one bar.

Other markers

  • plotchar is plotshape with a character (char) in place of the shape.
  • plotarrow takes a number, not a condition, and has no location, shape, size or text: colorup and colordown color its two kinds of arrow and the size follows the number.
  • A label carries text and may be created inside an if, because drawing calls have no top-level rule:
The x of a label is a bar index, so subtract an offset to mark a bar further back: on the newest bar, label.new(bar_index - 3, high[3], "3 back") marks the bar three before it, at that bar’s high.

The mistake to avoid

Calling plotshape, plotchar or plotarrow inside an if to pick the bar. They must be at the top level, so the condition goes in the first argument; two conditions mean two calls. Putting one inside a branch gives: plotshape() must be called in the global scope. See Text and markers.