Lipi Reference
Lipi

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, input display display, input string format) → 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.
display input display Controls where the plot is shown (pane, price scale, status line, data window). Use display.* constants; combine with +. Default is display.all.
format input string

Return Type

void

Example


          //@lipi=2
indicator("PlotShape Example", overlay=true)
buySignal = talib.crossover(talib.sma(close, 10), talib.sma(close, 20))
sellSignal = talib.crossunder(talib.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")