OPEN-SOURCE SCRIPT
Updated Breakout Detector (5-min)

//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)
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 chartOpen-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.