OPEN-SOURCE SCRIPT
Updated

Breakout Detector (5-min)

215
//version=5
indicator("Breakout Detector (5-min)", overlay=true)

// Define breakout range
length = input.int(20, minval=1, title="Lookback Period")
bullColor = color.green
bearColor = color.red

// Calculate highest high and lowest low of lookback period
highestHigh = ta.highest(high, length)
lowestLow = ta.lowest(low, length)

// Detect breakout
bullBreakout = close > highestHigh
bearBreakout = close < lowestLow

// Plot breakout signals
plotshape(bullBreakout, title="Bullish Breakout", location=location.abovebar, color=bullColor, style=shape.triangleup, size=size.small)
plotshape(bearBreakout, title="Bearish Breakout", location=location.belowbar, color=bearColor, style=shape.triangledown, size=size.small)

// Optional: Background color for breakout bars
bgcolor(bullBreakout ? color.new(bullColor, 85) : na)
bgcolor(bearBreakout ? color.new(bearColor, 85) : na)
Release Notes
Identify breakouts on 5 min chart

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.