ORB Algorithmic Day-Trading System
Opening-Range-Breakout strategy on TQQQ with an XGBoost gating layer that decides whether to take the day's signal at all. SQL-driven feature pipeline, multi-interval simulation, and a +19.1% annualized return improvement over the unfiltered ORB baseline.
Opening Range Breakout (ORB) goes long if price breaks the first 15–60 minutes’ high and short if it breaks the low; the bet is that early-session momentum continues. Tested honestly across years of TQQQ (3× leveraged Nasdaq), pure ORB works on a minority of days, gets stopped out on most, and slowly bleeds equity in chop.
The useful question isn’t whether ORB works in aggregate — it’s which days it works on. Some sessions have the one-directional momentum ORB needs; most don’t. If a 9:45 AM feature snapshot can predict the regime, the strategy can sit out the bad days and keep the good ones.
I trained an XGBoost classifier on the morning’s features (pre-market range, prior-day close-to-open gap, VIX regime, sector-relative strength, day-of-week, position in week, time-since-last-stopout) to predict whether the day belongs to the trade-it regime. Using the classifier as a gate on the underlying ORB signal lifted annualized return by 19.1% over unfiltered ORB on the test split, and kept the gated version flat through chop instead of bleeding equity.
System
- Data pipeline (SQL) — minute-bar TQQQ feature engineering: pre-market range, prior-day close-to-open gap, ATR-normalized opening range, sector-relative strength, VIX regime, day-of-week, position in week, time-since-last-stop-out
- ORB simulator — runs the strategy across multiple interval sizes (5/15/30/60-min ORB) plus a no-trade scenario for benchmark; produces per-day P&L tagged with the feature snapshot at decision time
- XGBoost gating model — predicts whether today’s feature snapshot belongs to a profitable-ORB regime, with hyperparameter tuning and time-series cross-validation
- Composite strategy — only takes the ORB signal when the gating model fires positive; falls through to flat otherwise
Result

+19.1% annualized return improvement over unfiltered ORB on the test split. The gated version clears buy-and-hold on a Sharpe basis, and crucially preserves performance in regimes where naked ORB blows up (Q4 2022 trendless / mean-reverting environment).
Improvements (post-original)
The original 2024 build was a single-model gated ORB. Subsequent improvements:
- Time-series cross-validation instead of standard CV — the original had look-ahead leakage from random folds across non-stationary feature distributions
- Feature drift monitoring — KL divergence between training-period and recent-period feature distributions, with a model-refit trigger when drift exceeds threshold
- Cost model — added per-trade slippage + half-spread costs at TQQQ realistic levels; the IRR uplift held but the Sharpe improvement compressed, which is the honest signal
- Multi-interval ensemble — instead of fitting one gating model per interval, train a single model that predicts the best interval for the day (multinomial), then trade that one
- SQL pipeline reorg — moved from per-day feature recomputation to incremental updates keyed on the latest bar; cut the daily feature build from minutes to seconds
Stack
- Python 3.10+ —
xgboost,pandas,numpy,scikit-learn - SQLite for the feature store (Postgres-ready schema)
- Backtest reporting in Jupyter
- TQQQ minute-bar history via
financeds(custom data layer I built for this and the LEAP project)
What it demonstrates
- Treating the strategy and the gating model as separable problems
- Honest ML evaluation: time-series CV, drift monitoring, cost model
- A working composite strategy, not just a backtest screenshot
Caveats
- TQQQ-specific. The feature distribution and the optimal ORB interval don’t transfer cleanly to underlying QQQ or to single-name stocks; the gating model would need to be re-fit per asset
- Survivorship-free underlying (TQQQ has been listed since 2010) so no listing-bias correction needed, but transfer to a name with corporate actions would require those adjustments