NR7 breakout strategy

On ES futures from January 2016 to July 2026, the NR7 breakout made $39,242 after costs and made money in 8 of 11 years.

BreakoutIntradayDaily barsBacktested Nov 6, 2026

NR7 breakout backtest, the result

Contract

E-mini S&P 500

  • +$39.2K

    Net after costs

    After $10,645 in fees and slippage

  • 8 of 11

    Years that made money

    January 2016 to July 2026

  • −$22.6K

    Largest drawdown

    Peak to trough, 1 contract

  • $105

    Average trade

    373 trades

NR7 breakout on ES, net after costs by month, from January 2016 to July 2026: +$39,242; buying and holding one ES contract: +$236,212

Net after costs by month, January 2016 to July 2026.

NR7 breakout rules

Find the narrowest day of the last 7, then trade the next day's break above its high or below its low.

A drawing of the rules on a made-up day, not a result.

  1. A day's range is its high less its low over the CME trading day, 18:00 to 17:00 New York.
  2. When a day's range is the narrowest of the last seven (ties count), the next trading day the first one-second close above that day's high buys and the first below its low sells short, once.
  3. The position is closed in that day's last minute, from 16:59 New York.
Decides on
Daily bars
Holds
Nothing overnight
Parameters
session minute 1,080, exit second 61,140

Results by year

It made money in 8 of 11 years on ES. Its best year was 2022, +$18,978, and its worst 2019, −$1,038.

Net after costs by year on ES, with trades, win rate, largest drawdown and buying and holding the same contract
YearNetTradesWin rateDrawdownBuy and hold
2016+$1464255%−$5,659+$11,497
2017−$3523450%−$3,698+$21,936
2018+$3,8363053%−$5,144−$8,589
2019−$1,0383754%−$7,068+$35,436
2020+$8143956%−$11,952+$27,761
2021+$9,9534255%−$13,952+$51,361
2022+$18,9783468%−$15,377−$45,939
2023+$1,5423653%−$9,717+$38,435
2024+$13,5373057%−$9,785+$42,947
2025+$5,7803557%−$14,291+$37,010
2026, Jan to Jul−$13,9531421%−$14,964+$24,355

NR7 breakout backtest results

On ES it made $49,888 before costs. Fees and slippage took $10,645 of that.

Net = before costs − fees − slippage
ES: $49,888 − $1,320 − $9,325 = $39,242
Every figure of the NR7 breakout backtest, by contract
FigureESNQ
Net after costs+$39,242+$94,216
Before costs+$49,888+$105,930
Fees$1,320$1,269
Slippage$9,325$10,445
Trades373359
Trades a year3634
Win rate54%51%
Profit factor1.211.30
Average trade$105$262
Average trade, 95% interval−$58 to $270−$44 to $565
Sharpe ratio0.380.51
Largest drawdown−$22,646−$30,616
Time in the market7%6%
Buying and holding the contract+$236,212+$401,004

The interval holds zero: this test cannot tell the average trade from no edge.

NR7 breakout code and Pine Script

The strategy as the backtest ran it, and the Pine Script our compiler wrote from it for TradingView.

NR7 breakout
nr7_breakout.py
1from atlantive import BUY, NEW_YORK, SELL, Bars, RollingMinMax, Session, Strategy2 3 4class Nr7Breakout(Strategy):5    """Crabel's NR7: after the narrowest daily range of seven, trade the break of that day's range.6 7    A day is the CME trading day, 18:00 to 17:00 New York, built from one-second bars. When a day's8    high-low range is the narrowest of the last seven (ties count), the next trading day the first9    one-second close above that day's high buys and the first close below its low sells short,10    once. The position is closed in that day's last minute, from 16:59 New York, the nearest the bar11    lane comes to its close. Nothing is read before seven days have closed on the contract.12    """13 14    data = "bars"15 16    class Params:17        session_minute: int = 108018        exit_second: int = 6114019        clip: int = 120 21    class State:22        clock: Session(zone=NEW_YORK)23        bars: Bars(interval_ns=1_000_000_000)24        ranges: RollingMinMax(window=7)25        day_key: int26        day_high: float27        day_low: float28        armed_day: int29        buy_level: float30        sell_level: float31        traded_day: int32 33    def on_event(self, view, ev, orders):34        self.clock.update(ev)35        if not self.bars.update(ev):36            return37        minute = self.clock.prev_minute38        second = self.clock.prev_second39        day = self.clock.prev_day40        high = float(self.bars.prev_high)41        low = float(self.bars.prev_low)42        close = float(self.bars.prev_close)43        trade_day = day44        if minute >= self.p.session_minute:45            trade_day = day + 146        closing = second + 1 >= self.p.exit_second and minute < self.p.session_minute47        if view.position != 0:48            if closing or trade_day != self.traded_day:49                if view.position > 0:50                    orders.ioc(side=SELL, qty=abs(view.position))51                else:52                    orders.ioc(side=BUY, qty=abs(view.position))53        if trade_day != self.day_key:54            if self.day_key != 0:55                width = self.day_high - self.day_low56                self.ranges.update(width)57                if self.ranges.ready == 1 and width <= self.ranges.min():58                    self.armed_day = trade_day59                    self.buy_level = self.day_high60                    self.sell_level = self.day_low61            self.day_key = trade_day62            self.day_high = high63            self.day_low = low64        else:65            self.day_high = max(self.day_high, high)66            self.day_low = min(self.day_low, low)67        if view.position == 0 and self.armed_day == trade_day and self.traded_day != trade_day and not closing:68            if close > self.buy_level:69                orders.ioc(side=BUY, qty=self.p.clip)70                self.traded_day = trade_day71            elif close < self.sell_level:72                orders.ioc(side=SELL, qty=self.p.clip)73                self.traded_day = trade_day
1//@version=62// Nr7Breakout, exported from Atlantive.3// Chart simulation: decisions use completed bars; market orders fill at the next bar open.4// Native fills, fees, data gaps and session boundaries can differ. Re-test on the target symbol.5// Use standard time-based candles and the strategy's timeframe, not synthetic chart prices.6// Pine v6 trims old trade records at its order limit; the strategy keeps calculating.7// Margin is explicitly disabled to retain the native signal simulation's sizing.8strategy("Nr7Breakout", overlay=true, initial_capital=100000.0, commission_type=strategy.commission.cash_per_contract, commission_value=1.68, default_qty_type=strategy.fixed, default_qty_value=1, calc_on_every_tick=false, process_orders_on_close=false, slippage=0, margin_long=0, margin_short=0)9 10if timeframe.in_seconds() != 111    runtime.error("Nr7Breakout was exported for the 1 second timeframe; set the chart to 1S.")12 13session_minute = input.int(1080, "session_minute", minval=-9007199254740991, maxval=9007199254740991)14exit_second = input.int(61140, "exit_second", minval=-9007199254740991, maxval=9007199254740991)15clip = input.int(1, "clip", minval=-9007199254740991, maxval=9007199254740991)16 17_q_safe_int(x) =>18    if math.abs(x) > 900719925474099119        runtime.error("an integer left the exact chart range; this run cannot be compared faithfully")20    int(x)21_q_int(x) => _q_safe_int(x < 0 ? math.ceil(x) : math.floor(x))22_q_iadd(a, b) => _q_safe_int(a + b)23 24_q_high = _q_int(math.round(high * 1000000000.0))25_q_low = _q_int(math.round(low * 1000000000.0))26_q_close = _q_int(math.round(close * 1000000000.0))27 28var int day_key = 029var float day_high = 0.030var float day_low = 0.031var int armed_day = 032var float buy_level = 0.033var float sell_level = 0.034var int traded_day = 035// clock: completed chart bar's opening timestamp (America/New_York).36_q_clock_prev_minute = hour(time, "America/New_York") * 60 + minute(time, "America/New_York")37_q_clock_prev_second = _q_clock_prev_minute * 60 + second(time, "America/New_York")38_q_clock_prev_weekday = (dayofweek(time, "America/New_York") + 5) % 739_q_clock_prev_day = int(timestamp("UTC", year(time, "America/New_York"), month(time, "America/New_York"), dayofmonth(time, "America/New_York"), 0, 0) / 86400000)40// Current clock: this chart bar's scheduled close, known without a future bar.41// A native next event after a data gap can carry a later time.42_q_clock_minute = hour(time_close, "America/New_York") * 60 + minute(time_close, "America/New_York")43_q_clock_second = _q_clock_minute * 60 + second(time_close, "America/New_York")44_q_clock_weekday = (dayofweek(time_close, "America/New_York") + 5) % 745_q_clock_day = int(timestamp("UTC", year(time_close, "America/New_York"), month(time_close, "America/New_York"), dayofmonth(time_close, "America/New_York"), 0, 0) / 86400000)46_q_clock_seen = 147var _q_ranges_buf = array.new_float(7, 0.0)48var int _q_ranges_idx = 049var int _q_ranges_count = 050var int _q_ranges_skipped = 051var _q_ranges_hiq = array.new_int(7, 0)52var int _q_ranges_hih = 053var int _q_ranges_hin = 054var _q_ranges_loq = array.new_int(7, 0)55var int _q_ranges_loh = 056var int _q_ranges_lon = 057int minute_l = na58int second_l = na59int day = na60float high_l = na61float low_l = na62float close_l = na63int trade_day = na64bool closing = false65float width = na66 67minute_l := _q_int(_q_clock_prev_minute)68second_l := _q_int(_q_clock_prev_second)69day := _q_int(_q_clock_prev_day)70high_l := _q_high * 1.071low_l := _q_low * 1.072close_l := _q_close * 1.073trade_day := _q_int(day)74if minute_l >= session_minute75    trade_day := _q_int(_q_iadd(day, 1))76closing := _q_iadd(second_l, 1) >= exit_second and minute_l < session_minute77if _q_int(strategy.position_size) != 078    if closing or trade_day != traded_day79        if _q_int(strategy.position_size) > 080            _q_qty1 = _q_int(math.abs(_q_int(strategy.position_size)))81            if _q_qty1 <= 082                runtime.error("market order quantity must be a positive whole unit")83            _q_pos1 = _q_int(strategy.position_size)84            if _q_pos1 < 0 or _q_pos1 > 0 and _q_qty1 < _q_pos185                runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")86            strategy.order("q1", strategy.short, _q_qty1)87        else88            _q_qty2 = _q_int(math.abs(_q_int(strategy.position_size)))89            if _q_qty2 <= 090                runtime.error("market order quantity must be a positive whole unit")91            _q_pos2 = _q_int(strategy.position_size)92            if _q_pos2 > 0 or _q_pos2 < 0 and _q_qty2 < -_q_pos293                runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")94            strategy.order("q2", strategy.long, _q_qty2)95if trade_day != day_key96    if day_key != 097        width := day_high - day_low98        _q_sample3 = width99        if na(_q_sample3) or math.abs(_q_sample3) > 1.7976931348623157e308100            _q_ranges_skipped := _q_ranges_skipped + 1101        else102            if _q_ranges_count >= 7 and _q_ranges_hin > 0 and array.get(_q_ranges_hiq, _q_ranges_hih) == _q_ranges_idx103                _q_ranges_hih := (_q_ranges_hih + 1) % 7104                _q_ranges_hin := _q_ranges_hin - 1105            if _q_ranges_count >= 7 and _q_ranges_lon > 0 and array.get(_q_ranges_loq, _q_ranges_loh) == _q_ranges_idx106                _q_ranges_loh := (_q_ranges_loh + 1) % 7107                _q_ranges_lon := _q_ranges_lon - 1108            array.set(_q_ranges_buf, _q_ranges_idx, _q_sample3)109            while _q_ranges_hin > 0110                _q_back3_hi = array.get(_q_ranges_hiq, (_q_ranges_hih + _q_ranges_hin - 1) % 7)111                if array.get(_q_ranges_buf, _q_back3_hi) <= _q_sample3112                    _q_ranges_hin := _q_ranges_hin - 1113                else114                    break115            array.set(_q_ranges_hiq, (_q_ranges_hih + _q_ranges_hin) % 7, _q_ranges_idx)116            _q_ranges_hin := _q_ranges_hin + 1117            while _q_ranges_lon > 0118                _q_back3_lo = array.get(_q_ranges_loq, (_q_ranges_loh + _q_ranges_lon - 1) % 7)119                if array.get(_q_ranges_buf, _q_back3_lo) >= _q_sample3120                    _q_ranges_lon := _q_ranges_lon - 1121                else122                    break123            array.set(_q_ranges_loq, (_q_ranges_loh + _q_ranges_lon) % 7, _q_ranges_idx)124            _q_ranges_lon := _q_ranges_lon + 1125            _q_ranges_idx := (_q_ranges_idx + 1) % 7126            _q_ranges_count := math.min(_q_ranges_count + 1, 7)127        if (_q_ranges_count >= 7 ? 1 : 0) == 1 and width <= (_q_ranges_count == 0 ? 0.0 : array.get(_q_ranges_buf, array.get(_q_ranges_loq, _q_ranges_loh)))128            armed_day := _q_int(trade_day)129            buy_level := day_high130            sell_level := day_low131    day_key := _q_int(trade_day)132    day_high := high_l133    day_low := low_l134else135    day_high := math.max(day_high, high_l)136    day_low := math.min(day_low, low_l)137if _q_int(strategy.position_size) == 0 and armed_day == trade_day and traded_day != trade_day and not closing138    if close_l > buy_level139        _q_qty4 = _q_int(clip)140        if _q_qty4 <= 0141            runtime.error("market order quantity must be a positive whole unit")142        _q_pos4 = _q_int(strategy.position_size)143        if _q_pos4 > 0 or _q_pos4 < 0 and _q_qty4 < -_q_pos4144            runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")145        strategy.order("q3", strategy.long, _q_qty4)146        traded_day := _q_int(trade_day)147    else if close_l < sell_level148        _q_qty5 = _q_int(clip)149        if _q_qty5 <= 0150            runtime.error("market order quantity must be a positive whole unit")151        _q_pos5 = _q_int(strategy.position_size)152        if _q_pos5 < 0 or _q_pos5 > 0 and _q_qty5 < _q_pos5153            runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")154        strategy.order("q4", strategy.short, _q_qty5)155        traded_day := _q_int(trade_day)

How it was tested

The published rules, never tuned on the data, with real costs on every fill. Every strategy here is tested the same way.

Market data
CME Globex daily bars, Jan 2, 2016 to Jul 31, 2026
Rules
As published, with the published parameters, never tuned on this data
Size
1 contract on every trade
Contract
The most traded one, rolled as the market moved
Fees
The broker's $0.50 a side, plus CME's and the NFA's fees when the window opens
Slippage
1 tick a side on ES, 2 in NQ's regular session and 3 outside it, 1 on other markets, where it was not measured
Stops and entries
Tested on 1-second closes and filled at the next bar
Contracts traded
ES: 43 contracts, ESH6 to ESU6NQ: 43 contracts, NQH6 to NQU6
Costs paid
ES: $1,320 in fees, $9,325 in slippageNQ: $1,269 in fees, $10,445 in slippage
Warm-up
None: each contract reads only its own bars
Flagged days
ES: NoneNQ: None Days the data holds too few bars for. Flagged, not removed.

Could you pass
a prop firm challenge
with the NR7 breakout?

A backtest says whether a strategy makes money. Our AI runs its trades through the rules of every prop firm account, then tells you which one it would pass and at what size.

No card needed. Free credits every month.

  • Most money: Blue Guardian Futures Direct 50K, $5,084
  • Best payout odds: Funded Futures Family Straight to Funded 50K, 98%
  • Fastest pass: Phidias Express to Live 50K, 11 days
Blue Guardian Futures Direct 50K
Most money

$5,084

Median net across 2,000 simulated runs

Evaluation
None
First payout
97%
Fees paid
$1,521

Median net across 2,000 simulated runs

Best 5%$13,143Worst 5%−$412
Day 060120180
Example: ES opening range breakout

Questions about the NR7 breakout

What is the NR7 breakout?

Find the narrowest day of the last 7, then trade the next day's break above its high or below its low. The rules follow Toby Crabel, Day Trading with Short Term Price Patterns and Opening Range Breakout (1990). Atlantive backtested it on CME futures from January 2016 to July 2026 after costs.

Is the NR7 breakout profitable on ES futures?

In this backtest it made money: on ES futures from January 2016 to July 2026 it made $39,242 after costs, over 373 trades, positive in 8 of 11 years; on NQ it made $94,216. Buying and holding one ES contract over the same window made $236,212. The average trade was $105, its 95% interval −$58 to $270. These are hypothetical results of a backtest, not of trading.

What are the NR7 breakout's rules?

A day's range is its high less its low over the CME trading day, 18:00 to 17:00 New York. When a day's range is the narrowest of the last seven (ties count), the next trading day the first one-second close above that day's high buys and the first below its low sells short, once. The position is closed in that day's last minute, from 16:59 New York. The rules follow Toby Crabel, Day Trading with Short Term Price Patterns and Opening Range Breakout (1990). Its parameters are the published ones, never tuned on the data it was tested on.

How was the NR7 breakout backtested?

On CME Globex data from January 2016 to July 2026, one contract, on daily bars, rolled to the most traded contract as the market moved, with the broker's and CME's fees and the slippage measured on each market. Stops and entries were tested on 1-second closes and filled at the next bar. Nothing was fitted to the data.

Can I run the NR7 breakout in TradingView?

Yes. The page carries its Pine Script, written by Atlantive's compiler from the same code the backtest ran, for TradingView's strategy tester. A chart's fills and fees can differ from the backtest's, so test it again on the symbol you trade.

Can I change the NR7 breakout and test it again?

Yes. Rerun it in Atlantive: a new chat opens with the strategy's rules in the box, for you to read, change and send. The agent writes the code, backtests it on the market and window you name, and reports the result with its costs.

Rerun it in Atlantive. Change the market, the dates or a rule, then send it.

A new chat opens with this in the box

Backtest Crabel's NR7 breakout on ES, 2016-01-02 to 2026-07-31, one contract on a $100,000 account with default costs: after a CME trading day whose range is the narrowest of seven, buy a one-second close above its high or sell one below its low the next day, once, and close in that day's last minute.

Never sent for you

May we measure this visit?

With your consent, Google Analytics and PostHog count visits to these pages. You can separately allow Google Ads to measure visits from our ads. Visit measurement starts only after you choose. Cookie policy