Functions
plotshape()
Marks the bars on which a condition holds, using a shape from a fixed set. The condition is the first argument, which is how you mark some bars and not others without moving the call: like every chart-output function it must be called at the top level.
Syntax
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
Arguments
series required series bool The condition. Required. The mark appears where it holds. title const string The name of the drawing. Const-form. shape input shape Which member of the `shape` set to draw. Twelve members exist. location input location Which member of the `location` set the mark sits at — above the bar, below it, at the pane's top or bottom edge, or at an absolute price. color series color The mark's colour. Series-form, so it may differ on every bar. offset input int Shifts the drawing along the chart. Input-form. text const string Text carried by the mark. Const-form: one fixed string for every mark, not a per-bar value. textcolor series color The colour of that text. Series-form. size input size Which member of the `size` set to draw at. force_overlay const bool Sets this drawing's overlay, separately from the script-wide setting. Return Type
void Example
indicator("PlotShape Example", overlay=true)
buySignal = talib.crossover(ta.sma(close, 10), talib.sma(close, 20))
sellSignal = talib.crossunder(ta.sma(close, 10), talib.sma(close, 20))
plotshape(series=buySignal, location=location.belowbar, shape=shape.triangleup, color=color.green, size=size.small, title="Buy Signal")
plotshape(series=sellSignal, location=location.abovebar, shape=shape.triangledown, color=color.red, size=size.small, title="Sell Signal")