qbuntuqbuntu
marginalregime_dependent· equity· breakout· momentum· trend-following

Trend Following / Donchian Breakout (US S&P 500)

slug: trend-following-us-sp500
performance summary
Sharpe (median)
+0.22
Max DD
-20.6%
Win rate
Alpha (ann.)
p-value
0.57
backtest period: 2022-02-012026-06-01
Sharpe across 768 grid runs:median 0.22best 0.83 (not representative)worst -0.73p25–p75 0.000.41

Hypothesis

Donchian channel breakout: stocks breaking above N-day highs continue trending. LONG breakout stocks with configurable exit methods. Applied to S&P 500 constituents.

Why it didn't work

Across 768 grid combinations, median Sharpe=0.22, best=0.83. Primary failure mode: regime_dependent.

Facts (7)

Average monthly return correlation with other strategies in DOWN regime: -0.18
Pairwise Pearson correlation of monthly returns across 42 strategies, filtered to DOWN regime months (N=3, N225 < SMA20 < SMA60)
correlation-0.18
Average monthly return correlation with other strategies (full period): -0.03
Pairwise Pearson correlation of monthly returns across 42 strategies, full backtest period
correlation-0.03
Best grid Sharpe ratio is 0.83 (p=0.085).
period 2022-02-01–2026-06-01; cost=5bps
sharpe_ratio0.83
Median Sharpe across 768 grid runs is 0.22.
Full grid of 768 parameter combinations.
sharpe_ratio0.22
Median Sharpe in DOWN regime is -0.37 across 768 runs.
Regime=DOWN, N225 SMA20/SMA60 classification.
sharpe_ratio-0.37
Median Sharpe in FLAT regime is -0.12 across 768 runs.
Regime=FLAT, N225 SMA20/SMA60 classification.
sharpe_ratio-0.12
Median Sharpe in UP regime is 0.77 across 768 runs.
Regime=UP, N225 SMA20/SMA60 classification.
sharpe_ratio0.77

Runs (30)

runparamssharpeUPFLATDOWN
channel_days=20, holding_days=5, n_stocks=5, exit_method=hold, cost_bps=5, regime_gate=False
r-trend-following-us-sp500-0000
cost_bps: 5
n_stocks: 5
exit_method: "hold"
+0.34+0.16+0.56+0.56
channel_days=20, holding_days=5, n_stocks=5, exit_method=hold, cost_bps=5, regime_gate=True
r-trend-following-us-sp500-0001
cost_bps: 5
n_stocks: 5
exit_method: "hold"
+0.64+0.75+0.56+0.56
channel_days=20, holding_days=5, n_stocks=5, exit_method=hold, cost_bps=10, regime_gate=False
r-trend-following-us-sp500-0002
cost_bps: 10
n_stocks: 5
exit_method: "hold"
+0.20+0.03+0.34+0.45
channel_days=20, holding_days=5, n_stocks=5, exit_method=hold, cost_bps=10, regime_gate=True
r-trend-following-us-sp500-0003
cost_bps: 10
n_stocks: 5
exit_method: "hold"
+0.52+0.67+0.34+0.45
channel_days=20, holding_days=5, n_stocks=5, exit_method=channel_exit, cost_bps=5, regime_gate=False
r-trend-following-us-sp500-0004
cost_bps: 5
n_stocks: 5
exit_method: "channel_exit"
+0.34+0.16+0.56+0.56
channel_days=20, holding_days=5, n_stocks=5, exit_method=trailing_mid, cost_bps=5, regime_gate=False
r-trend-following-us-sp500-0008
cost_bps: 5
n_stocks: 5
exit_method: "trailing_mid"
+0.34+0.16+0.56+0.56
channel_days=20, holding_days=5, n_stocks=50, exit_method=hold, cost_bps=5, regime_gate=False
r-trend-following-us-sp500-0036
cost_bps: 5
n_stocks: 50
exit_method: "hold"
+0.18-0.09+0.32+0.86
channel_days=20, holding_days=5, n_stocks=50, exit_method=channel_exit, cost_bps=10, regime_gate=True
r-trend-following-us-sp500-0043
cost_bps: 10
n_stocks: 50
exit_method: "channel_exit"
+0.32+0.37+0.01+0.61
channel_days=20, holding_days=10, n_stocks=20, exit_method=trailing_mid, cost_bps=5, regime_gate=False
r-trend-following-us-sp500-0080
cost_bps: 5
n_stocks: 20
exit_method: "trailing_mid"
+0.28+1.05-0.30-0.43
channel_days=20, holding_days=20, n_stocks=10, exit_method=trailing_mid, cost_bps=5, regime_gate=True
r-trend-following-us-sp500-0117
cost_bps: 5
n_stocks: 10
exit_method: "trailing_mid"
+0.22+1.16+0.05-1.24
channel_days=20, holding_days=60, n_stocks=5, exit_method=hold, cost_bps=5, regime_gate=False
r-trend-following-us-sp500-0144
cost_bps: 5
n_stocks: 5
exit_method: "hold"
+0.24+0.46+0.07-0.12
channel_days=20, holding_days=60, n_stocks=5, exit_method=trailing_mid, cost_bps=10, regime_gate=True
r-trend-following-us-sp500-0155
cost_bps: 10
n_stocks: 5
exit_method: "trailing_mid"
+0.35+0.81+0.05-0.16
channel_days=40, holding_days=5, n_stocks=5, exit_method=hold, cost_bps=5, regime_gate=False
r-trend-following-us-sp500-0192
cost_bps: 5
n_stocks: 5
exit_method: "hold"
+0.48+0.59+0.74-0.02
channel_days=40, holding_days=5, n_stocks=50, exit_method=hold, cost_bps=5, regime_gate=True
r-trend-following-us-sp500-0229
cost_bps: 5
n_stocks: 50
exit_method: "hold"
+0.51+0.58+0.55+0.23
channel_days=40, holding_days=10, n_stocks=20, exit_method=hold, cost_bps=10, regime_gate=False
r-trend-following-us-sp500-0266
cost_bps: 10
n_stocks: 20
exit_method: "hold"
-0.13+0.71-0.65-1.13
channel_days=40, holding_days=20, n_stocks=10, exit_method=hold, cost_bps=10, regime_gate=True
r-trend-following-us-sp500-0303
cost_bps: 10
n_stocks: 10
exit_method: "hold"
+0.23+1.15+0.19-1.05
channel_days=40, holding_days=60, n_stocks=5, exit_method=channel_exit, cost_bps=5, regime_gate=False
r-trend-following-us-sp500-0340
cost_bps: 5
n_stocks: 5
exit_method: "channel_exit"
+0.36+0.37+0.63-0.20
channel_days=40, holding_days=60, n_stocks=50, exit_method=channel_exit, cost_bps=5, regime_gate=True
r-trend-following-us-sp500-0377
cost_bps: 5
n_stocks: 50
exit_method: "channel_exit"
+0.40+1.24-0.20-0.36
channel_days=60, holding_days=5, n_stocks=5, exit_method=hold, cost_bps=5, regime_gate=True
r-trend-following-us-sp500-0385
cost_bps: 5
n_stocks: 5
exit_method: "hold"
+0.83+1.07+0.59+0.47
channel_days=60, holding_days=5, n_stocks=20, exit_method=channel_exit, cost_bps=10, regime_gate=True
r-trend-following-us-sp500-0415
cost_bps: 10
n_stocks: 20
exit_method: "channel_exit"
+0.26+0.58+0.15-0.47
channel_days=60, holding_days=10, n_stocks=10, exit_method=trailing_mid, cost_bps=5, regime_gate=False
r-trend-following-us-sp500-0452
cost_bps: 5
n_stocks: 10
exit_method: "trailing_mid"
-0.02+0.86-0.81-0.88
channel_days=60, holding_days=10, n_stocks=50, exit_method=hold, cost_bps=10, regime_gate=False
r-trend-following-us-sp500-0470
cost_bps: 10
n_stocks: 50
exit_method: "hold"
-0.73+0.44-1.55-1.21
channel_days=60, holding_days=20, n_stocks=5, exit_method=trailing_mid, cost_bps=10, regime_gate=False
r-trend-following-us-sp500-0490
cost_bps: 10
n_stocks: 5
exit_method: "trailing_mid"
+0.08+0.68-0.02-1.06
channel_days=60, holding_days=20, n_stocks=50, exit_method=trailing_mid, cost_bps=10, regime_gate=True
r-trend-following-us-sp500-0527
cost_bps: 10
n_stocks: 50
exit_method: "trailing_mid"
-0.04+1.35-0.78-0.74
channel_days=60, holding_days=60, n_stocks=50, exit_method=hold, cost_bps=5, regime_gate=False
r-trend-following-us-sp500-0564
cost_bps: 5
n_stocks: 50
exit_method: "hold"
-0.11+0.36-0.38-0.95
channel_days=120, holding_days=5, n_stocks=5, exit_method=hold, cost_bps=5, regime_gate=False
r-trend-following-us-sp500-0576
cost_bps: 5
n_stocks: 5
exit_method: "hold"
+0.63+0.47+1.22+0.21
channel_days=120, holding_days=5, n_stocks=20, exit_method=hold, cost_bps=10, regime_gate=False
r-trend-following-us-sp500-0602
cost_bps: 10
n_stocks: 20
exit_method: "hold"
+0.01+0.16-0.21-0.07
channel_days=120, holding_days=10, n_stocks=10, exit_method=hold, cost_bps=10, regime_gate=True
r-trend-following-us-sp500-0639
cost_bps: 10
n_stocks: 10
exit_method: "hold"
-0.10+0.89-0.73-0.65
channel_days=120, holding_days=20, n_stocks=5, exit_method=channel_exit, cost_bps=5, regime_gate=False
r-trend-following-us-sp500-0676
cost_bps: 5
n_stocks: 5
exit_method: "channel_exit"
+0.67+0.95+1.15-0.41
channel_days=120, holding_days=20, n_stocks=50, exit_method=channel_exit, cost_bps=5, regime_gate=True
r-trend-following-us-sp500-0713
cost_bps: 5
n_stocks: 50
exit_method: "channel_exit"
+0.11+1.34-0.31-0.70

Target universe

S&P 500 constituents, ~503 stocks

Related strategies

source: qbuntu-analysis · kabu STATION REST API + J-Quants daily bars
computed asof: 2026-07-28T01:10:02

Related strategies