Methodology

Final Strategy Parameters

Parameter Value
Selected Symbol QQQ
Universe SPY, QQQ, IWM, XLE, GLD, TLT
Entry Rule Close breaks above prior 20-day channel
ATR Window 14
Initial Stop 2.0 x ATR
Trailing Stop 3.0 x ATR
Timeout 15 trading days
Direction Long only
Breakout Strength Filter At least 0.20 ATR past the channel
Trend Filter Close must be above the 20-day moving average
Breakout Failure Delay Do not classify breakout failure until day 4
Transaction Cost 10 bps round-turn split across entry and exit
Position Sizing 1% equity risk budget, capped at 95% notional deployment

Strategy Idea

This project studies a volatility and channel breakout strategy on liquid ETFs. The market phenomenon we are trying to capture is short- to medium-horizon trend continuation after price escapes a recent trading range. The baseline idea is simple: when price breaks out of a channel, volatility is often expanding and some of those breakouts continue far enough to compensate for the many small failures.

The project then adds a supervised-learning extension. Instead of replacing the breakout rule, the model acts as a position-scaling overlay that uses only information available at the time of entry to decide whether a breakout deserves full size or a smaller size.

Data Pipeline

  • Historical daily OHLCV data is pulled from Interactive Brokers through shinybroker.
  • Each symbol is stored separately in data/market_history/.
  • Macro and regime context is added with VIX and SHY.
  • Options-derived volatility series from IBKR are stored separately in data/options_history/.
  • The baseline strategy is evaluated across the ETF universe, and the best risk-adjusted baseline asset is selected as the showcase symbol.

The current showcase asset is QQQ.

Sample Period And Holdout Design

The project separates the historical sample into two roles:

  1. The training and strategy-development sample uses the data before 2025-10-01. This period is used to evaluate the baseline breakout rules, create supervised-learning labels, fit the logistic-style breakout-quality model, and compare the hard-filter and position-scaling ML overlays.
  2. The fixed out-of-sample holdout runs from 2025-10-01 through the latest saved data in April 2026. For this period, the model is treated as frozen. It scores each new breakout using only information available at the signal date.

This split is important because the ML label intentionally uses future data to answer “would this breakout have been profitable?” That is acceptable when constructing labels inside the training sample, but it would be look-ahead bias if the future holdout outcomes were used to train the model. The out-of-sample test avoids that by stopping training before October 2025 and then evaluating the later trades as if they were brand new live signals.

The Results page therefore reports both views: the broader in-sample backtest, which shows whether the rules made sense historically, and the fixed October 2025-April 2026 holdout, which is the more important test of whether the model still helped after it stopped learning.

Entry Orders

The final baseline entry rule is:

  1. Compute a 20-day Donchian-style channel using the prior rolling high and low.
  2. Enter long when the close breaks above the prior 20-day channel high.
  3. Require two confirmation filters:
    • the close must be above the 20-day moving average trend filter
    • the breakout must exceed 0.20 ATR
  4. Execute the trade at the next trading day’s open.
  5. Size the trade with a 1% equity risk budget, capped at 95% notional deployment.
  6. Apply 10 bps total transaction costs across entry and exit.

This is still a channel breakout strategy. The trend and strength filters do not replace the channel rule; they are there to reduce false breakouts.

Why These Parameters

  • 20-day channel: this produced a stronger final QQQ showcase backtest than the highest-ranked universe sweep row, while still keeping the breakout logic interpretable and trade frequency usable.
  • 20-day trend filter: a shorter trend filter matched the faster breakout horizon better than the earlier 50-day version.
  • 0.20 ATR breakout threshold: this was large enough to avoid tiny channel pokes but not so strict that the strategy stopped trading.
  • 2.0 ATR initial stop: this gave the breakout room to move while still defining risk tightly enough for position sizing.
  • 3.0 ATR trailing stop: this lets winners run while protecting profits once the move extends.
  • 15-day timeout: if the breakout has not worked within roughly three trading weeks, the signal has likely decayed.
  • 4-day breakout-failure delay: immediate breakout-failure exits created excessive churn in early versions of the baseline, so a short grace period was added.

The file parameter_sweep_top100.csv records the broader universe sweep. Its highest-ranked row favored a 30-day channel with a wider 3.0 ATR stop and 2.5 ATR trail on an average cross-asset score. The final code keeps the 20-day, 2.0 ATR, 3.0 ATR setup because the final project is a showcase QQQ strategy and that configuration produced the better selected-asset backtest on the current saved sample.

Final Params vs Top Sweep Row

parameter_set selected_symbol channel_lookback stop_atr trailing_stop_atr trade_count sharpe_ratio total_return max_drawdown
final_current_params QQQ 20 2.0000 3.0000 48 1.0666 0.1107 -0.0230
sweep_top_universe_params QQQ 30 3.0000 2.5000 40 0.8399 0.0186 -0.0252

Exit Orders

Each trade has four explicit fates:

  1. Successful
    • the trailing stop locks in a profitable move after the breakout extends
  2. Stop-loss triggered
    • price hits the initial stop at 2.0 ATR below entry
  3. Timed out
    • the trade reaches the maximum holding window of 15 trading days
  4. Breakout failure
    • after the 4-day grace period, price closes back inside the breakout channel

These fates are coded directly in the backtest and also appear in the trade blotter.

Baseline Selection Logic

The project does not simply pick the ETF with the strongest recent momentum. It first runs the same breakout rules across the ETF universe, then selects the symbol with the strongest strategy-level risk-adjusted result. That is why QQQ is the current showcase asset.

ETF Universe Screen

symbol rows start_date end_date recent_return_63d annualized_volatility avg_dollar_volume_63d selection_score selection_status
XLE 1256 2021-04-26 2026-04-24 0.1554 0.2606 2857863583.7270 0.5965 eligible
QQQ 1256 2021-04-26 2026-04-24 0.0614 0.2240 28998442776.0514 0.2742 eligible
IWM 1256 2021-04-26 2026-04-24 0.0480 0.2256 6503583266.0440 0.2127 eligible
SPY 1256 2021-04-26 2026-04-24 0.0306 0.1713 40954871322.0518 0.1787 eligible
TLT 1256 2021-04-26 2026-04-24 -0.0186 0.1584 2590969369.6263 -0.1172 eligible
GLD 1256 2021-04-26 2026-04-24 -0.0677 0.1784 5274605788.8946 -0.3793 eligible

Supervised Learning Extension

Label Construction

For each breakout event:

  • look ahead 15 trading days
  • mark the trade as 1 if price reaches +1.5 ATR before -1.0 ATR
  • mark it as 0 otherwise

This uses future data only to create the label. The model never sees future information as input features.

Model Inputs

The final selected-asset ML overlay uses a compact core_iv feature set:

  • breakout_strength
  • distance_from_trend
  • distance_from_upper_channel
  • channel_width_pct
  • atr_pct
  • iv_hv_spread
  • iv_hv_ratio
  • iv_zscore_60d
  • iv_trend_20d

These were chosen because they balance:

  • breakout quality
  • local volatility expansion
  • options-implied volatility confirmation

Role Of Options Implied Volatility

The baseline strategy enters trades using only price-based breakout rules, but the machine-learning overlay uses options-derived implied volatility to judge breakout quality. For each breakout event, the model includes iv_hv_spread, iv_hv_ratio, iv_zscore_60d, and iv_trend_20d, all measured using information available at the signal date.

The intuition is that a price breakout confirmed by rising or unusually rich implied volatility is more likely to reflect a real regime shift, because options traders are pricing a larger future move. A price breakout without IV confirmation may be a weaker signal or a temporary channel poke.

In the final strategy, implied volatility does not independently trigger trades. It helps the model scale position size up or down after the baseline breakout rule has already identified a trade candidate.

Model Usage

Train the model, then skip low-probability breakouts. The project tests that idea directly and compares it against a conservative sizing overlay. The final overlay does not delete trades outright. Instead, it scales position size up or down on QQQ based on the model’s estimated breakout quality. This kept the strategy interpretable while preserving the breakout opportunity set.

The Results page contains the performance comparison, including the fixed October 2025-April 2026 holdout run. Methodology is kept focused on how the signal, labels, features, and model are constructed.

This strategy is designed as a controlled breakout system, not a high-frequency win-rate maximizer. The economic idea is to catch a smaller number of real volatility expansions while accepting that many breakouts will fail quickly or time out. That is why the strategy uses explicit stop-losses, timeouts, and small risk-per-trade sizing. The goal is not to be right on every signal; it is to keep losses bounded while allowing genuine regime shifts to contribute meaningful gains.