OPEN-SOURCE SCRIPT

Small Body Candle Highlighter

178
//version=5
indicator("Small Body Candle Highlighter", overlay=true)

// Set max difference in points (adjust as needed based on asset's price scale)
max_diff = 1.5

// Calculate the open-close difference
body_diff = math.abs(close - open)

// Conditions
small_body = body_diff <= max_diff
bullish = close > open
bearish = open > close

// Colors
bull_color = color.new(color.green, 0)
bear_color = color.new(color.red, 0)

// Plot shapes on qualifying candles
plotshape(small_body and bullish, location=location.abovebar, color=bull_color, style=shape.circle, size=size.small, title="Bullish Small Body")
plotshape(small_body and bearish, location=location.belowbar, color=bear_color, style=shape.circle, size=size.small, title="Bearish Small Body")

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.