Types
shape
The twelve markers `plotshape` can draw: `xcross`, `cross`, `triangleup`, `triangledown`, `flag`, `circle`, `arrowup`, `arrowdown`, `labelup`, `labeldown`, `square` and `diamond`. Written `shape.triangleup` and so on. The interpreter records which member you named and leaves the drawing to the chart.
Fields / Members
xcross XCross cross Cross triangleup Triangle Up triangledown Triangle Down flag Flag circle Circle arrowup Arrow Up arrowdown Arrow Down labelup Label Up labeldown Label Down square Square diamond Diamond Example
indicator("Shape Example", overlay=true)
// Define bullish and bearish engulfing conditions
bullishEngulfing = close > open and close[1] < open[1] and close > close[1] and open < open[1]
bearishEngulfing = close < open and close[1] > open[1] and close < close[1] and open > open[1]
// Plot a triangle up for bullish engulfing
plotshape(series=bullishEngulfing, location=location.belowbar, shape=shape.triangleup, color=color.green, title="Bullish Engulfing")
// Plot a triangle down for bearish engulfing
plotshape(series=bearishEngulfing, location=location.abovebar, shape=shape.triangledown, color=color.red, title="Bearish Engulfing")
// Plot a cross at every bar where the close is equal to the open (Doji)
doji = close == open
plotshape(series=doji, location=location.abovebar, shape=shape.cross, color=color.blue, title="Doji")