OPEN-SOURCE SCRIPT
Updated Breakout Pullback Continuation

//version=5
indicator("Breakout Pullback Continuation", overlay=true)
// === Parameters ===
lookback = 20 // Look for breakouts above this many bars
volumeFactor = 1.3 // How much volume needs to exceed average
pullbackDepth = 3 // Max bars to wait for pullback + green
// === Track State ===
var float breakoutLevel = na
var int breakoutBar = na
volumeSMA = ta.sma(volume, 20)
// === Detect Breakout ===
recentHigh = ta.highest(high, lookback)
breakout = close > recentHigh[1]
if breakout
breakoutLevel := close
breakoutBar := bar_index
// === Check for Pullback After Breakout
pullbackOccurred = na(breakoutLevel) ? false : close < breakoutLevel and bar_index > breakoutBar
// === Check for Confirmation Candle
greenCandle = close > open
decentRange = (high - low) > (close * 0.003)
volumeSpike = volume > volumeSMA * volumeFactor
confirmation = pullbackOccurred and greenCandle and decentRange and volumeSpike and (bar_index - breakoutBar <= pullbackDepth)
// === Signal Plot ===
plotshape(confirmation, title="Pullback Continuation", location=location.belowbar, color=color.lime, style=shape.triangleup)
alertcondition(confirmation, title="Breakout Pullback Alert", message="🚀 {{ticker}} breakout-pullback-confirmation at {{close}}")
indicator("Breakout Pullback Continuation", overlay=true)
// === Parameters ===
lookback = 20 // Look for breakouts above this many bars
volumeFactor = 1.3 // How much volume needs to exceed average
pullbackDepth = 3 // Max bars to wait for pullback + green
// === Track State ===
var float breakoutLevel = na
var int breakoutBar = na
volumeSMA = ta.sma(volume, 20)
// === Detect Breakout ===
recentHigh = ta.highest(high, lookback)
breakout = close > recentHigh[1]
if breakout
breakoutLevel := close
breakoutBar := bar_index
// === Check for Pullback After Breakout
pullbackOccurred = na(breakoutLevel) ? false : close < breakoutLevel and bar_index > breakoutBar
// === Check for Confirmation Candle
greenCandle = close > open
decentRange = (high - low) > (close * 0.003)
volumeSpike = volume > volumeSMA * volumeFactor
confirmation = pullbackOccurred and greenCandle and decentRange and volumeSpike and (bar_index - breakoutBar <= pullbackDepth)
// === Signal Plot ===
plotshape(confirmation, title="Pullback Continuation", location=location.belowbar, color=color.lime, style=shape.triangleup)
alertcondition(confirmation, title="Breakout Pullback Alert", message="🚀 {{ticker}} breakout-pullback-confirmation at {{close}}")
Release Notes
//version=5indicator("Breakout Pullback Continuation (Simple)", overlay=true)
// === SETTINGS ===
lookback = 20 // How far back to define a breakout
pullbackBars = 5 // How many bars we allow a pullback before confirmation
// === TRACK BREAKOUT LEVEL ===
recentHigh = ta.highest(high, lookback)
breakout = close > recentHigh[1]
// === Store breakout info (price + bar index)
var float breakoutLevel = na
var int breakoutBar = na
if breakout
breakoutLevel := close
breakoutBar := bar_index
// === Define Pullback + Confirmation ===
// Pullback = close drops below breakout level AFTER breakout
pullback = na(breakoutLevel) ? false : close < breakoutLevel and bar_index > breakoutBar
// Confirm bar = green candle after pullback, within N bars from breakout
greenConfirm = close > open and bar_index - breakoutBar <= pullbackBars and pullback
// === Plot confirmation marker ===
plotshape(greenConfirm, title="Pullback Continuation", location=location.belowbar, color=color.lime, style=shape.triangleup, size=size.small)
alertcondition(greenConfirm, title="Pullback Continuation Alert", message="🚀 {{ticker}} breakout pullback confirmed at {{close}}")
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.
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.