The Narrow Range Breakout Algorithm (NRBOAlgo) exploits one of the most reliable patterns in technical analysis: volatility compression leads to volatility expansion. When a market forms its narrowest range in N periods (NR4 = 4 periods, NR7 = 7 periods), it signals pending explosive movement.

Quick Facts:
The Narrow Range Breakout Algorithm (NRBOAlgo) exploits one of the most reliable patterns in technical analysis: volatility compression leads to volatility expansion. When a market forms its narrowest range in N periods (NR4 = 4 periods, NR7 = 7 periods), it signals pending explosive movement.
The algorithm identifies these compression points and positions for the breakout, capturing the energy release when price finally escapes the tight range. This is a favorite pattern of institutional traders for its reliability and defined risk parameters.
NARROW RANGE DETECTION The algorithm tracks bar range across a lookback window:
When the current bar has the smallest range in N periods, it's flagged as a potential NR setup.
ATR FILTER Ensures the narrow range is genuinely compressed:
This prevents triggering on naturally small bars in low-volatility environments where "narrow" is relative.
CONSECUTIVE NR TRACKING Multiple consecutive NR bars increase setup quality:
A sequence of 2-3 NR bars suggests extreme compression.
BREAKOUT LEVEL STORAGE Once an NR pattern is confirmed:
BREAKOUT DETECTION Entry triggers when price exceeds NR levels:
The buffer prevents false breakouts from noise.
EXPIRATION LOGIC NR setups don't last forever:
LONG SIGNAL: ✅ NR pattern identified (consecutive NR bars >= minNRBars) ✅ ATR filter passed (range is genuinely compressed) ✅ Price breaks above nrHigh + buffer ✅ Breakout occurs within cancelBarsAfterNR window ✅ VMAlgo confirmation (if enabled) ✅ Session and day-of-week filters passed
SHORT SIGNAL: ✅ NR pattern identified (consecutive NR bars >= minNRBars) ✅ ATR filter passed (range is genuinely compressed) ✅ Price breaks below nrLow - buffer ✅ Breakout occurs within cancelBarsAfterNR window ✅ VMAlgo confirmation (if enabled) ✅ Session and day-of-week filters passed
NR DETECTION:
BREAKOUT:
VMALGO INTEGRATION:
✅ DAILY NR7 BREAKOUTS for swing trading ✅ INTRADAY NR4 SETUPS during session opens ✅ PRE-NEWS COMPRESSION before high-impact events ✅ RANGE BOUND MARKETS awaiting directional resolution ✅ VOLATILITY EXPANSION trades after quiet periods
FOR CLASSIC NR7 (DAILY): • nrLookback = 7 • minNRBars = 1 • maxRangeATR = 0.5 • breakoutBuffer = 0.1-0.15 • cancelBarsAfterNR = 3-5
FOR AGGRESSIVE NR4 (INTRADAY): • nrLookback = 4 • minNRBars = 1 • maxRangeATR = 0.6 • breakoutBuffer = 0.05 • cancelBarsAfterNR = 3
FOR EXTREME COMPRESSION: • Increase minNRBars to 2-3 • Lower maxRangeATR to 0.3-0.4 • Higher conviction but fewer signals
FOR SESSION-SPECIFIC: • Use Asian session NR patterns • Trade the London/NY breakout • Configure sessions accordingly
Subscribe to Pattern-Based or higher to access
Own the complete Pine Script source code forever. Modify, customize, and use it on your own TradingView account.
What you get with source code:
We use cookies to enhance your browsing experience, analyze site traffic, and personalize content. By clicking "Accept All", you consent to our use of cookies. Read our Privacy Policy for more information.