Final Strategy Parameters
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:
- 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.
- 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:
- Compute a
20-day Donchian-style channel using the prior rolling high and low.
- Enter
long when the close breaks above the prior 20-day channel high.
- Require two confirmation filters:
- the close must be above the
20-day moving average trend filter
- the breakout must exceed
0.20 ATR
- Execute the trade at the next trading day’s open.
- Size the trade with a
1% equity risk budget, capped at 95% notional deployment.
- 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
Exit Orders
Each trade has four explicit fates:
Successful
- the trailing stop locks in a profitable move after the breakout extends
Stop-loss triggered
- price hits the initial stop at
2.0 ATR below entry
Timed out
- the trade reaches the maximum holding window of
15 trading days
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.
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.
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.