DeskTested

Trading tools, tested on a real desk.

Updated Oct 21, 2026Desk NotesClaims verified ✓Anthony M.

Opening Range Breakout Backtest: How a Silent Data Gap Turned +5.0% Into +64.6%

Our opening range breakout backtest showed +64.6% for 2020–2023 until a silent join was fixed. The real figure was +5.0%, and the strategy was shelved.

Our opening range breakout backtest reported +64.6% over 2020–2023, but the correct figure was +5.0%. A daily data series that began in mid-2020 left the 200-day moving average undefined until 11 May 2021. A join then silently dropped every trade it couldn’t label with that average, deleting all of 2020 and early 2021 from the test without raising an error.

Corrected, the strategy lost money in three of the four years, and the desk shelved it. This page shows the numbers on both sides of the fix, the code pattern that caused the bug, and why it only came to light because a planned validation step was actually run.

Every figure below is a backtest simulation — not live results, not a prediction, not advice. The figures come from a desk research record (orb_results.md, run 2026-07-01) that states its data source, costs and test periods. No positions, signals or account values appear on this page.

The strategy and its two test windows

The strategy was an intraday opening range breakout (ORB) on 5-minute bars, and the study compared three versions of it. One was ungated. One had a VIX gate that traded only when the VIX was at or above 25. One had a trend gate that traded only when QQQ was below its 200-day simple moving average (SMA). A step called attach_regime labelled every trade with that SMA regime. The original test, as the record’s header states it:

Run date: 2026-07-01 | Window: 2024-01-01 → 2026-06-30 (625 trading days) | Cost: 2.5 bps/side | Data: Alpaca SIP 5-min bars

The original window’s intraday bars came from Alpaca. The research record was already sceptical of the VIX gate’s result in that window. Its caveat line reads:

Caveats: VIX≥25 is only 37 trades in 2.5 yr (14 in 2026); ≥28/≥30 too thin to trust; threshold suggested by this same sample. Next validation: extend the backtest to 2020–2023 (COVID + 2022 bear = many high-VIX days) to confirm the VIX≥25 edge across more stress regimes before any paper deployment.

The second window, 2020–2023, is where the bug lived.

Lesson 1: a data-coverage limit can pass for a strategy result

The record’s correction, verbatim:

A data bug inflated the VIX-gate result above. Alpaca IEX daily QQQ only returns data from 2020-07-27, so the 200-day SMA wasn’t valid until 2021-05-11, and attach_regime silently dropped every trade with a missing SMA — deleting all of 2020 (COVID) and early 2021.

That is what our run received on 1 July 2026. We haven’t re-checked that endpoint since, so read it as an observation from our run, not as a statement about Alpaca’s data today. The arithmetic holds: counting NYSE trading days from 27 July 2020, the 200th falls on 11 May 2021, the first date a 200-day average can exist.

Nothing errored. The test ran, produced trades and printed +64.6%, which is what made it dangerous. The test window said 2020–2023, but the trades only covered the part of it the daily data could label. The extension had been aimed at two stress periods, the COVID crash and the 2022 bear, and the first of them was the part that went missing. 2022 stayed in, because the SMA was valid from May 2021.

The fix had two parts. QQQ’s daily closes were re-sourced from Yahoo, which has the full history. And attach_regime was changed so it never drops a trade the VIX gate can evaluate just because the SMA is missing, with a regression test so the bug can’t come back. The corrected results:

Year (VIX ≥ 25 gate) Trades Return
2020 (COVID) 153 −33.6%
2021 21 −10.2%
2022 (grinding bear) 131 +79.9%
2023 3 −2.1%
2020–2023 aggregate, corrected +5.0% (Sharpe 0.33, −54% max drawdown)
2020–2023 aggregate, bug run +64.6%

Compounded, the four yearly returns reproduce the corrected aggregate: 0.664 × 0.898 × 1.799 × 0.979 ≈ 1.050. The other two gates over the same years, from the same record:

Bar chart of 2020–2023 aggregate backtest returns for the ORB strategy: VIX gate +64.6% in the bug run and +5.0% corrected, trend gate below the 200-day SMA −20.4%, ungated −38.4%

The trend gate returned −20.4% over 2020–2023, against +11.3% in the 2024–2026 window. Ungated, the strategy returned −38.4% with a −64% drawdown. All backtest simulations over the stated periods, not live results, not a prediction, not advice.

This is the same class of silent bad data as the pre-inception rows we found in one price series, which we catalogued in backtesting mistakes that only real data reveals.

Lesson 2: a join must never drop rows silently

The defect wasn’t exotic. It’s the most ordinary line in data work: merge two tables, then drop rows with a missing value. Below is a simplified illustration of the pattern and its repair. It isn’t the desk’s code.

# Simplified illustration of the failure and the fix (not the desk's code).
import pandas as pd

def attach_regime_buggy(trades, daily):
    out = trades.merge(daily[["date", "close", "sma200"]], on="date", how="left")
    return out.dropna(subset=["sma200"])        # every trade before the SMA exists vanishes

def attach_regime(trades, daily):
    out = trades.merge(daily[["date", "close", "sma200"]], on="date",
                       how="left", validate="many_to_one")
    out["regime"] = "unlabelled"                # a missing SMA is a label, not a deletion
    has_sma = out["sma200"].notna()
    out.loc[has_sma, "regime"] = (out["close"] < out["sma200"])[has_sma].map(
        {True: "below_sma", False: "above_sma"})
    assert len(out) == len(trades), "join changed the trade count"
    return out

def check_coverage(daily, test_start):
    """Fail loudly if the indicator starts after the test window does."""
    first_bar = daily["date"].min()
    first_sma = daily.loc[daily["sma200"].notna(), "date"].min()
    if first_sma > pd.Timestamp(test_start):
        raise ValueError(f"data starts {first_bar:%Y-%m-%d}, SMA starts "
                         f"{first_sma:%Y-%m-%d}, test starts {test_start}")

# Regression test: the trade count must survive the join.
def test_attach_regime_keeps_unlabelled_trades():
    trades = pd.DataFrame({"date": pd.to_datetime(["2020-03-16", "2022-06-13"])})
    daily = trades.assign(close=[100.0, 100.0], sma200=[float("nan"), 110.0])
    assert len(attach_regime_buggy(trades, daily)) == 1   # the bug: one trade gone
    out = attach_regime(trades, daily)
    assert list(out["regime"]) == ["unlabelled", "below_sma"]

Two rules come out of it. First, a step that adds a label must return the same number of rows it received. If a trade can’t be labelled, mark it as unlabelled and let the filter that needs the label decide what to do with it. Second, check coverage before you trust a window. check_coverage would have stopped the 2020–2023 run before it started, because the SMA began 16 months after the test did.

Lesson 3: the bug surfaced only because the planned extension was run

Inside the original 2024–2026 window, the bug couldn’t show. The daily data started in July 2020, so by 2024 every trade had an SMA to be labelled with, and nothing was dropped. The bug could only bite in a window that began before May 2021. The record’s own caveat is what put the test there: it had already written down “extend the backtest to 2020–2023 … before any paper deployment”, and the extension was then actually run.

That’s why our validation sequence has us commit to the next test before we see a result, not after. Had the extension been optional, the VIX gate would have gone forward on 37 trades from one window, carrying a bug that window couldn’t reveal.

What the corrected numbers say

The corrected table doesn’t support “ORB works when the VIX is high”. 2020 and 2022 both had many high-VIX days, as the record’s caveat expected, and they produced the worst and the best years in the test: −33.6% and +79.9%. The record’s conclusion, verbatim:

Conclusion: the VIX-gated ORB edge does NOT generalize. It is positive only in slow, grinding, trending bears (2022) and 2024-2025; it LOST money in the COVID crash (2020) […] because V-shaped crash-and-reverse days whipsaw the breakout. Positive in 2 regimes, negative in 3. This is a bet on which type of volatility shows up, not a durable edge. Do not deploy — ORB is fully shelved.

The +5.0% aggregate came with a −54% maximum drawdown. One good year paid for three bad ones, and the threshold itself was chosen on the sample it was first tested on. The record says not to deploy it and marks the strategy fully shelved.

How this differs from the published ORB research

Zarattini and Aziz’s 2023 paper, “Can Day Trading Really Be Profitable?”, backtests a different ORB rule. It trades QQQ in the direction of the first 5-minute candle, with a stop at that candle’s high or low and a target of 10 times the risk or the close, over 1 January 2016 to 17 February 2023. Its Table 1 charges “$0.0005 per share” in commission and notes “We assumed no slippage in fills.” Ours used a VIX gate and a 200-day regime label and charged 2.5 bps per side. Our result doesn’t test their strategy and doesn’t refute it. What carries over is the method: costs and a stated test window are part of the result.

Frequently asked questions

Does an opening range breakout strategy work?

Our VIX-gated version didn’t hold up. Over 2020–2023 it returned +5.0% with a −54% maximum drawdown, lost money in three of four years, and was shelved. That’s one backtest simulation of one variant with stated costs, not a verdict on every ORB rule, and not a prediction.

Why did the bug make the backtest look better?

Because the stretch it deleted held the strategy’s worst year. The data gap removed 2020 and early 2021, and 2020 was the worst year in the corrected test at −33.6%. A gap that removed a good year would have made the result look worse, and it would have been just as wrong.

How do you catch silent row drops in a backtest?

Assert that the row count is unchanged after every join or labelling step, and log what any filter removes and why. Before running a window, compare the first valid date of every indicator with the window’s start date. In this case the two were 16 months apart.

What data does an opening range breakout backtest need?

Intraday bars for the entries and exits, and daily history long enough to warm up any indicator that gates or labels the trades. A 200-day average needs 200 trading days of data before the first day you test.


Sources: desk research record orb_results.md (run 2026-07-01), via pipeline/desk-log/2026-W36.md; Zarattini, C. and Aziz, A., “Can Day Trading Really Be Profitable?” (SSRN 4416622; first version 24 April 2023; the version read is dated 22 September 2025), read 20 October 2026 and re-checked 21 October 2026.

This is educational content about research methodology, not financial advice. Every return, drawdown, Sharpe ratio and trade count above comes from a historical backtest simulation over a stated window. None is a live result, a prediction or a recommendation to trade any strategy. We have no affiliate or commercial relationship with Alpaca or the paper’s authors.