Functions
plotshape()
Plots visual shapes on the chart.
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 Series of data to be plotted as shapes. Series is treated as a series of boolean values for all location values except location.absolute. Required argument. title const string Title of the plot. shape input shape Type of plot. Possible values are: shape.xcross, shape.cross, shape.triangleup, shape.triangledown, shape.flag, shape.circle, shape.labelup, shape.labeldown, shape.square, shape.diamond. Default value is shape.xcross. location input location Location of shapes on the chart. Possible values are: location.abovebar, location.belowbar, location.top, location.bottom, location.absolute. Default value is location.abovebar. color series color Color of the candles. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument. offset input int Shifts shapes to the left or to the right on the given number of bars. Default is 0. text const string Text to display with the shape. You can use multiline text, to separate lines use '
' escape sequence. Example: 'line one
line two'. textcolor series color Color of the candles. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument. size input size Size of shapes on the chart. Possible values are: size.auto, size.tiny, size.small, size.normal, size.large, size.huge. Default is size.auto. force_overlay const bool If true, the plotted results will display on the main chart pane, even when the script occupies a separate pane. Optional. The default is false. 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")