Tradehook — Trading Automation Service
lowPattern-Based

NRBOAlgo

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.

TradingView Preview
See this algorithm in action on real charts
NRBOAlgo TradingView chart
Performance Metrics
Historical backtesting results
53.8%
Win Rate
1.22
Profit Factor
8.3%
Max Drawdown
$87
Avg Trade
Based on 145 trades

About This Algorithm

NARROW RANGE BREAKOUT STRATEGY

Quick Facts:

  • Category: Breakout / Volatility Compression
  • Markets: Futures, Forex, Stocks
  • Timeframes: 15min, 1H, 4H, Daily

Overview

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.


How It Works

NARROW RANGE DETECTION The algorithm tracks bar range across a lookback window:

  • barRange = High - Low (current bar's range)
    • narrowestRange = Lowest(barRange, nrLookback)
    • isNarrowestBar = barRange <= narrowestRange

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:

  • rangeATRRatio = barRange / ATR
    • passATRFilter = rangeATRRatio <= maxRangeATR

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:

  • consecutiveNR counter increments for each qualifying bar
    • Resets when a bar doesn't meet NR criteria
    • minNRBars parameter sets the threshold (default: 1)

A sequence of 2-3 NR bars suggests extreme compression.

BREAKOUT LEVEL STORAGE Once an NR pattern is confirmed:

  • nrHigh = High of the NR bar(s)
    • nrLow = Low of the NR bar(s)
    • These levels define the breakout zones

BREAKOUT DETECTION Entry triggers when price exceeds NR levels:

  • breakoutBuffer = ATR × breakoutBuffer (default: 0.1)
    • Long Breakout: High > nrHigh + breakoutBuffer
    • Short Breakout: Low < nrLow - breakoutBuffer

The buffer prevents false breakouts from noise.

EXPIRATION LOGIC NR setups don't last forever:

  • cancelBarsAfterNR parameter (default: 5)
    • If no breakout within N bars, setup expires
    • Prevents stale levels from triggering late entries

Signal Generation

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


Key Parameters

NR DETECTION:

  • nrLookback (7): Lookback period for NR detection (7 = NR7, 4 = NR4)
    • minNRBars (1): Minimum consecutive NR bars required
    • maxRangeATR (0.5): Maximum range as ATR ratio for compression

BREAKOUT:

  • breakoutBuffer (0.1): ATR multiple above/below NR levels for entry
    • cancelBarsAfterNR (5): Bars until NR setup expires

VMALGO INTEGRATION:

  • useVMConfirmation (true): Require momentum confirmation

Best Use Cases

✅ 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


Optimization Tips

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

Customer Reviews

No reviews yet. Be the first to review this algorithm!
Pattern-Based
Requires Pattern-Based Plan

Subscribe to Pattern-Based or higher to access

Subscription Access

Get access to this indicator/strategy on TradingView through our invite-only system. Your TradingView account will be granted access.

One-Time Purchase

Own the complete Pine Script source code forever. Modify, customize, and use it on your own TradingView account.

$750
Subscribe to any tier to unlock one-time purchases

What you get with source code:

  • Complete Pine Script v5 source code
  • Lifetime ownership - no recurring fees
  • Full customization rights
  • Use on your own TradingView account
PlatformTradingView
Subscription AccessTradingView Invite
One-Time PurchaseSource Code
LicensePersonal Use

We Value Your Privacy

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.