TQQQ/SQQQ SMA-grid backtest

Phase 1 trend-following sweep · 3,348,900 combos (2,972,310 distinct equity curves) · data 2010-02-11 → 2026-05-19 · 2026-05-20

1. framing

The strategy is a three-state rotation driven by a single signal instrument (QQQ) against four simple-moving-average windows. On every daily bar the state machine is

CASH        → LONG_TQQQ    when QQQ > SMA(buy_T)
LONG_TQQQ   → CASH         when QQQ < SMA(sell_T)
CASH        → SHORT_SQQQ   when QQQ < SMA(buy_S)
SHORT_SQQQ  → CASH         when QQQ > SMA(sell_S)

Phase 1 of this sweep enforces sell_T ≥ buy_T and sell_S ≥ buy_S — trend-following only. Each SMA window is drawn from {1..60}, so the constrained grid has 1830 × 1830 = 3,348,900 combos.

Sweep wall-clock: 0.6 min · ~95,522 backtests/sec. Slippage: 5.0 bp per state transition; $0 commission; adjusted-close prices.

This document tells you what the search surface actually looks like — not just the single best combo. The histogram in §5 is the antidote to the table in §2.

2. top-50 winners

Sorted by final equity multiple. Each row is one DISTINCT equity curve — combos sharing a curve (e.g. dormant short-leg parameters varying freely when buy_S=1 structurally never fires) are collapsed by a deterministic equity-curve fingerprint. n_eq is the size of the equivalence class; type classifies which legs actually traded; dormant parameters render as -. Of the 3,348,900 grid combos, 2,972,310 produce distinct equity curves.

delta is the (test − train) / train ratio from the walk-forward in §7 — green = generalizes up, red = generalizes down.

#typebuy_Tsell_Tbuy_Ssell_Sn_eqfinal×Sharpemax_ddCalmartrades%long%shorttrain×test×delta
1LONG-only2244--60124.63×0.9446.1%0.7552973.5%0.0%3.66×29.09×+694.7%
2LONG-only2235--60121.13×0.9546.7%0.7445571.3%0.0%3.37×30.65×+810.3%
3LONG-only2234--60118.62×0.9546.6%0.7344571.0%0.0%3.34×30.19×+803.0%
4LONG-only2144--60118.12×0.9350.9%0.6754373.8%0.0%4.20×23.72×+464.6%
5LONG-only1244--60117.70×0.8972.3%0.4772176.3%0.0%4.29×26.38×+514.5%
6LONG-only1246--60114.79×0.8970.5%0.4873376.6%0.0%4.50×24.54×+444.9%
7LONG-only2236--60114.70×0.9450.0%0.6846771.5%0.0%3.10×31.49×+914.9%
8LONG-only2246--60114.54×0.9242.5%0.8054773.9%0.0%3.62×27.04×+646.4%
9LONG-only1245--60113.00×0.8970.4%0.4872576.4%0.0%3.96×27.48×+593.8%
10LONG-only2245--60112.97×0.9242.4%0.8053573.7%0.0%3.19×30.30×+850.3%
11LONG-only2243--60112.33×0.9351.7%0.6552573.2%0.0%3.52×27.28×+675.3%
12LONG-only1256--60111.18×0.8870.8%0.4870978.7%0.0%4.38×24.49×+459.8%
13LONG-only1255--60110.95×0.8872.8%0.4670578.6%0.0%4.67×22.88×+389.5%
14LONG-only1253--60109.89×0.8872.0%0.4770778.3%0.0%3.91×27.03×+590.5%
15LONG-only2146--60108.56×0.9147.7%0.7056174.2%0.0%4.16×22.05×+430.3%
16LONG-only2145--60107.08×0.9147.6%0.7054973.9%0.0%3.66×24.71×+575.2%
17LONG-only2237--60106.65×0.9250.0%0.6747771.8%0.0%2.97×30.57×+927.8%
18LONG-only2143--60106.57×0.9156.0%0.5953773.5%0.0%4.04×22.24×+450.3%
19LONG-only1254--60106.10×0.8772.8%0.4670578.5%0.0%4.30×23.74×+451.6%
20LONG-only1248--60105.77×0.8870.5%0.4772777.3%0.0%4.63×22.00×+375.3%
21LONG-only2242--60104.32×0.9250.1%0.6652172.8%0.0%3.05×29.17×+856.0%
22LONG-only2544--60103.85×0.9252.4%0.6348172.7%0.0%4.65×18.58×+299.8%
23LONG-only2134--60103.48×0.9251.4%0.6445971.2%0.0%3.97×21.90×+451.5%
24LONG-only1252--60103.47×0.8772.0%0.4671178.1%0.0%3.90×25.55×+555.1%
25LONG-only1257--60103.12×0.8770.8%0.4771578.6%0.0%4.38×24.47×+459.3%
26LONG-only2238--60102.37×0.9250.1%0.6649571.9%0.0%2.96×29.47×+894.9%
27LONG-only1243--60101.78×0.8875.2%0.4471376.0%0.0%3.77×25.95×+587.7%
28LONG-only2534--60101.69×0.9352.9%0.6239770.2%0.0%3.84×21.99×+473.3%
29LONG-only1249--60100.30×0.8768.3%0.4872977.3%0.0%4.08×23.66×+479.6%
30LONG-only2142--6098.97×0.9054.6%0.6053373.0%0.0%3.51×23.79×+578.6%
31LONG-only1242--6098.80×0.8774.4%0.4471175.4%0.0%3.42×27.75×+711.2%
32LONG-only2744--6098.73×0.9154.1%0.6044172.3%0.0%4.32×19.70×+355.6%
33LONG-only2241--6098.53×0.9150.1%0.6551772.5%0.0%2.88×29.17×+913.2%
34LONG-only1250--6098.50×0.8669.8%0.4772977.6%0.0%3.97×23.91×+502.6%
35LONG-only1247--6097.41×0.8670.5%0.4673176.9%0.0%4.05×23.14×+470.8%
36LONG-only2644--6095.95×0.9157.2%0.5745772.5%0.0%4.57×18.20×+298.1%
37LONG-only2535--6095.78×0.9252.9%0.6140970.5%0.0%3.88×20.47×+427.2%
38LONG-only2546--6095.44×0.9049.2%0.6649973.1%0.0%4.61×17.26×+274.7%
39LONG-only2135--6095.07×0.9151.4%0.6347171.6%0.0%3.75×21.34×+469.9%
40LONG-only2536--6094.87×0.9155.8%0.5841970.7%0.0%3.74×21.05×+463.1%
41LONG-only2240--6094.74×0.9050.1%0.6550572.4%0.0%2.89×27.95×+867.2%
42LONG-only2044--6094.60×0.8956.1%0.5855974.0%0.0%4.31×19.30×+347.3%
43LONG-only1258--6094.51×0.8574.0%0.4471778.8%0.0%4.30×22.86×+431.9%
44LONG-only2545--6093.95×0.9049.2%0.6649172.9%0.0%4.05×19.32×+377.1%
45LONG-only2543--6093.60×0.9057.3%0.5647772.4%0.0%4.47×17.43×+290.0%
46LONG-only2141--6093.48×0.9054.6%0.5952972.8%0.0%3.31×23.79×+619.2%
47LONG-only2248--6092.40×0.8942.6%0.7554774.6%0.0%3.37×23.43×+594.7%
48LONG-only2233--6091.86×0.9146.6%0.6944170.6%0.0%3.22×24.26×+653.0%
49LONG-only1241--6090.85×0.8674.4%0.4371775.3%0.0%3.15×27.73×+781.3%
50LONG-only1444--6090.84×0.8673.6%0.4469175.9%0.0%4.37×18.85×+331.3%

3. buy-and-hold baselines

The four passive baselines a strategy must beat to be interesting:

baselinefinal×CAGRmax_dd
QQQ B&H18.51×19.7%35.1%
TQQQ B&H353.93×43.5%81.7%
SQQQ B&H0.00×-53.1%100.0%
1/N(QQQ, TQQQ, SQQQ)124.15×34.6%79.4%

4. heatmaps

Two 2-D slices through the 4-D grid. The winner combo is (22, 44, 1, 1).

4a. (buy_T, sell_T) with short-leg fixed at the winner

4b. (buy_S, sell_S) with long-leg fixed at the winner

5. distribution of outcomes

Where do the buy-and-hold baselines sit in the 3.35M-combo final-value distribution? Most of the mass is mediocre; the long right tail is where the headline numbers live.

6. equity curves

Top-5 strategies vs the three buy-and-hold baselines. Log scale on the y-axis so the leveraged baselines don't flatten the rest.

7. walk-forward delta

For each of the top-100 DEDUPED combos by full-sample final value (one representative per equity-curve equivalence class), we re-ran the backtest on train (2010-02 → 2018-12) and test (2019-01 → today). Points hugging the diagonal generalize; points dropping below it overfit.

Of the 100 combos that beat cash in-sample, 100 also beat cash out-of-sample (100.0%).

8. honest discussion

survivorship bias. QQQ, TQQQ, and SQQQ all survived the sweep period. A real strategy needs to handle tickers that fail or get delisted; we did not.
leveraged-ETF decay. TQQQ and SQQQ are 3x daily-rebalanced — they bleed in choppy markets and explode in trending ones. The backtest uses adjusted close which handles splits, but daily decay is structural, not a fee.
slippage assumption. 5 bp per transition is generous for retail liquidity in these tickers, but optimistic during market stress. Combos with thousands of trades feel the slippage more than the headline number suggests.
3.35M combos guarantee lucky picks. Even pure noise generates extreme outliers at this sample size. The walk-forward in §7 is the honest filter; the headline table in §2 is the seduction.
signal source ≠ traded instrument. We trigger on QQQ but trade TQQQ/SQQQ — there is an implicit assumption that the leveraged-fund tracking error stays small. Historically true on a daily basis; not guaranteed in a stressed market.

9. reproducibility

git SHA0fef187c7a465980b3e6e3a456de17780ee61b12
results.parquet SHA-2560b09b564d3647b90b39a0ecda0070cb18d3a03ed143868eddd0885f49bdcd96f
walkforward.parquet SHA-2567a7e776d4f7ec6d9de10a07acd5631684272286caf795d0f4f3d5e2166a528a3
dataset SHA-2565bf77eabae631d84c8029caa841fdbf6873e78dc91fa8c66250757d9feb8a721
run date (UTC)2026-05-20
sweep wall-clock0.58 min
max_window60
slippage5.00 bp/transition
combos3,348,900
distinct equity curves2,972,310

To reproduce: uv run rainier sma-sweep --phase 1