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.
In plain English
Day-traders have a strategy called the Opening Range Breakout (ORB). The idea: in the first 15–60 minutes of the trading day, the stock makes a high and a low. If the price later breaks above that opening high, you go long (bet it keeps rising). If it breaks below the opening low, you go short. The bet is that early-session momentum continues.
ORB is the kind of strategy you see all over finance YouTube, usually with a screenshot of one good month. The honest version is much less impressive: tested across years of TQQQ (a 3× leveraged Nasdaq ETF), pure ORB works on some days, gets stopped out on most, and slowly bleeds equity in months where the market just chops sideways without trending.
The interesting question isn’t “does ORB work” — it’s “on which days does ORB work?” Some days have the kind of one-directional momentum ORB needs; other days have nothing of the sort. If we could predict the difference at 9:45 AM (right after the opening range completes), we’d only take the trade when conditions favor it.
That’s a machine-learning problem. Given the morning’s features — pre-market range, gap from yesterday’s close, VIX, sector strength, day-of-week, etc. — predict whether this day belongs to the trade-this regime or the skip-it regime. I trained an XGBoost classifier on this, used it as a gate on the underlying ORB strategy, and got a +19.1% annualized return improvement vs. running ORB unfiltered. The gated version preserves the upside of trend days and sits flat through the chop.
System
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