QU100 Top-N Backtest — with a QQQ 55-day VWAP Regime Gate

Same strategy as the base sweep — each ranking day at the close, hold an equal-weight basket of the QU100 money-flow top-N names, rebalance daily — but now overlaid with a single market-regime switch: stay invested only when QQQ is above its 55-day rolling VWAP; otherwise sit in cash. Start $100,000. Gross of trading costs (0 bp).

Window: 2020-10-01 → 2026-06-04 · 1,402 ranking-days (~5.7 yrs) · rankings from QU100 top100 · basket prices = yfinance adjusted close · N swept 1 → 100. Gated vs. ungated shown side-by-side.

The regime gate — a single VWAP threshold (no hysteresis band)

At each ranking-day t the gate computes QQQ's 55-bar rolling VWAP and compares it to QQQ's close:
hlc3      = (high + low + close) / 3                       # typical price, per bar
VWAP55[t] = sum(hlc3 * volume, last 55 bars) / sum(volume, last 55 bars)

VWAP uses QQQ's raw HLC3×volume (not adjusted close), and the gate compares raw close to raw VWAP55 — same price basis on both sides. The Pine offset=2 plot shift is not applied (using it would be look-ahead). It is a single threshold: the state can flip every day on close-vs-VWAP, with no buffer band. The strategy starts flat; the first ranking-day's close-vs-VWAP55 sets the initial state.

Best Sharpe (gated)
N=44 · 1.07
ungated was 1.00 at N=44
Best return (gated)
N=6 · +241%
ungated peak was +283% (N=44)
Time in market
71.6%
74 regime flips over 5.7 yrs
Best-N drawdown cut
−47% → −40%
N=44, gated vs ungated
Verdict: the VWAP55 gate improves risk-adjusted return and cuts drawdown across almost the entire N range, at a modest cost to raw return. At the diversified sweet spot (N=44, the ungated best) Sharpe rises from 1.00 to 1.07 and max drawdown shrinks from −47% to −40%, while total return eases from +283% to +227% — you give up ~56 points of gross return to buy a meaningfully smoother ride. The gate's whole job is visible in 2022: it parks the book in cash for ~71% of that bear-market year, which is where the drawdown reduction comes from. Best Sharpe now lands at N=44 (1.07); best raw return shifts down to N=6 (+241%) because concentration is less punishing once the worst market stretches are sidestepped. Typical time in market is 71.6% with 74 regime flips — more whipsaw than a slow moving average would give (the single-threshold VWAP has no buffer band), but the trade is worth it: gated Sharpe clears 1.0 across roughly N=30–90 and beats QQQ buy-and-hold (Sharpe 0.90) on a risk-adjusted basis through most of the range. All figures gross of costs; turnover is high, so a costed run is a separate study.

1 · Per-N table — gated, with ungated reference (0 bp, gross, N=1..100)

Top-N Total retCAGRMax DDAnn volSharpeTime in mktAvg holdRound-trips Ungat retUngat DDUngat Sh
1-8.8%-1.6%-86.2%76.4%0.2972%1.3d781-33.1%-93.2%0.25
2+5.0%+0.9%-71.4%48.3%0.2472%1.4d1,460+13.7%-75.6%0.30
3+147.1%+17.3%-68.2%39.9%0.6072%1.4d2,059+171.5%-73.1%0.61
4+202.9%+21.6%-74.5%35.8%0.7372%1.5d2,691+175.3%-78.5%0.64
5+232.4%+23.6%-69.0%33.4%0.8172%1.5d3,296+208.6%-74.7%0.71
6 best return+240.7%+24.1%-65.7%30.8%0.8772%1.5d3,938+228.8%-76.1%0.77
7+146.9%+17.3%-66.4%29.0%0.7072%1.5d4,508+202.5%-73.2%0.74
8+188.9%+20.6%-58.7%28.2%0.8272%1.6d5,061+216.5%-69.7%0.77
9+187.6%+20.5%-53.2%28.1%0.8272%1.6d5,641+187.6%-66.0%0.73
10+204.2%+21.7%-52.9%27.4%0.8772%1.6d6,191+202.9%-66.4%0.76
11+174.8%+19.5%-53.9%26.9%0.8172%1.6d6,780+181.0%-65.1%0.73
12+216.1%+22.5%-44.5%26.3%0.9272%1.6d7,333+241.1%-56.0%0.84
13+185.1%+20.3%-46.6%25.8%0.8672%1.6d7,914+189.6%-60.1%0.75
14+171.9%+19.3%-47.8%25.5%0.8372%1.6d8,490+196.1%-57.4%0.77
15+183.0%+20.1%-48.6%25.2%0.8772%1.6d9,051+188.8%-59.3%0.76
16+170.2%+19.2%-51.1%24.8%0.8572%1.6d9,617+181.1%-62.5%0.76
17+161.8%+18.5%-50.5%24.6%0.8372%1.6d10,196+159.1%-61.9%0.71
18+151.4%+17.6%-48.6%24.4%0.8072%1.6d10,788+161.2%-58.6%0.72
19+123.5%+15.2%-48.4%24.1%0.7272%1.6d11,385+126.1%-58.6%0.64
20+108.0%+13.8%-46.9%23.8%0.6772%1.6d11,987+145.0%-56.5%0.68
21+121.5%+15.1%-46.4%23.7%0.7272%1.6d12,577+164.5%-55.5%0.73
22+118.8%+14.8%-46.4%23.6%0.7172%1.6d13,150+153.8%-53.4%0.71
23+162.1%+18.5%-44.9%25.1%0.8172%1.6d13,697+208.3%-51.3%0.80
24+206.2%+21.8%-41.5%25.0%0.9372%1.6d14,288+268.2%-48.0%0.91
25+198.4%+21.3%-43.2%24.7%0.9272%1.6d14,873+264.3%-48.6%0.91
26+218.7%+22.7%-40.6%24.5%0.9772%1.6d15,437+278.3%-47.4%0.94
27+216.4%+22.5%-40.1%24.1%0.9872%1.6d16,004+274.1%-46.1%0.94
28+204.9%+21.7%-40.5%24.0%0.9672%1.6d16,578+251.5%-47.3%0.91
29+210.4%+22.1%-39.9%23.6%0.9872%1.6d17,148+246.8%-47.6%0.90
30+222.9%+23.0%-38.9%23.7%1.0172%1.6d17,726+254.5%-46.1%0.92
31+209.6%+22.0%-39.1%23.5%0.9872%1.6d18,334+248.5%-46.5%0.91
32+216.4%+22.5%-38.7%23.4%1.0072%1.6d18,898+271.7%-45.3%0.95
33+229.3%+23.4%-40.6%23.3%1.0372%1.6d19,499+267.1%-45.2%0.95
34+200.9%+21.4%-41.6%23.2%0.9772%1.6d20,089+224.9%-46.1%0.88
35+200.5%+21.4%-41.4%23.1%0.9772%1.6d20,672+215.8%-45.4%0.86
36+211.2%+22.2%-40.5%22.9%1.0172%1.6d21,252+229.1%-46.0%0.89
37+207.9%+21.9%-40.5%22.8%1.0072%1.6d21,816+224.7%-44.1%0.89
38+211.6%+22.2%-41.0%22.7%1.0172%1.6d22,377+236.1%-44.0%0.91
39+224.4%+23.1%-41.3%22.6%1.0572%1.6d22,945+261.5%-44.7%0.96
40+221.9%+22.9%-41.7%22.5%1.0572%1.6d23,537+251.0%-46.9%0.94
41+221.5%+22.9%-42.0%22.4%1.0572%1.6d24,124+258.2%-47.9%0.96
42+222.1%+22.9%-41.1%22.3%1.0672%1.6d24,725+260.8%-47.5%0.96
43+222.8%+22.9%-40.0%22.3%1.0672%1.6d25,315+278.7%-46.0%0.99
44 best Sharpe+227.1%+23.2%-40.4%22.2%1.0772%1.6d25,869+283.2%-46.6%1.00
45+213.9%+22.3%-40.1%22.1%1.0472%1.6d26,461+263.3%-46.6%0.97
46+211.8%+22.2%-40.4%22.0%1.0472%1.6d27,067+262.6%-46.9%0.97
47+210.2%+22.1%-40.1%21.9%1.0472%1.6d27,666+259.0%-47.4%0.97
48+207.2%+21.9%-40.8%21.8%1.0472%1.6d28,263+264.7%-48.0%0.98
49+205.2%+21.7%-42.4%21.6%1.0472%1.6d28,839+263.5%-47.4%0.98
50+194.2%+21.0%-42.0%21.5%1.0172%1.6d29,401+249.0%-46.8%0.96
51+195.9%+21.1%-41.7%21.4%1.0272%1.6d29,996+245.4%-46.7%0.96
52+196.7%+21.1%-41.8%21.4%1.0272%1.6d30,567+243.3%-47.3%0.95
53+196.4%+21.1%-41.0%21.3%1.0272%1.6d31,111+243.5%-46.9%0.95
54+205.0%+21.7%-41.2%21.3%1.0572%1.6d31,673+255.7%-47.8%0.98
55+200.1%+21.4%-42.1%21.2%1.0472%1.6d32,258+249.5%-47.3%0.97
56+195.5%+21.0%-41.3%21.2%1.0372%1.6d32,837+240.9%-47.7%0.95
57+188.3%+20.5%-41.4%21.1%1.0172%1.6d33,411+231.0%-47.8%0.94
58+172.1%+19.3%-42.5%21.0%0.9672%1.6d33,995+202.8%-49.1%0.88
59+168.3%+19.0%-42.5%20.9%0.9572%1.6d34,568+199.4%-48.9%0.87
60+172.2%+19.3%-41.7%20.8%0.9772%1.6d35,130+203.2%-48.5%0.88
61+169.3%+19.1%-41.5%20.8%0.9672%1.6d35,700+204.0%-48.5%0.88
62+175.9%+19.6%-41.4%20.7%0.9972%1.6d36,298+215.7%-48.3%0.91
63+169.5%+19.1%-41.2%20.7%0.9672%1.6d36,886+208.8%-47.7%0.90
64+176.0%+19.6%-41.0%20.6%0.9972%1.6d37,473+215.4%-47.4%0.91
65+172.1%+19.3%-41.6%20.6%0.9872%1.6d38,028+208.0%-47.6%0.90
66+178.8%+19.8%-41.5%20.6%1.0072%1.6d38,563+214.1%-48.1%0.91
67+183.3%+20.2%-40.1%20.5%1.0272%1.6d39,133+222.9%-47.7%0.93
68+185.9%+20.3%-40.2%20.5%1.0272%1.6d39,720+222.1%-48.1%0.93
69+185.3%+20.3%-40.1%20.5%1.0272%1.6d40,285+219.2%-47.9%0.92
70+181.1%+20.0%-40.9%20.5%1.0172%1.6d40,813+216.4%-48.1%0.92
71+179.4%+19.9%-41.3%20.5%1.0172%1.7d41,348+211.1%-48.3%0.91
72+177.4%+19.7%-40.9%20.4%1.0072%1.7d41,900+214.3%-47.7%0.92
73+187.6%+20.5%-40.6%20.4%1.0472%1.7d42,487+228.4%-47.8%0.95
74+185.6%+20.3%-40.8%20.4%1.0372%1.7d43,044+229.3%-47.7%0.95
75+181.1%+20.0%-40.7%20.3%1.0272%1.7d43,610+224.8%-47.5%0.94
76+178.0%+19.8%-41.3%20.3%1.0172%1.7d44,177+222.9%-47.8%0.94
77+175.5%+19.6%-41.2%20.3%1.0072%1.7d44,742+224.2%-47.8%0.94
78+171.7%+19.3%-40.6%20.3%0.9972%1.7d45,303+217.5%-48.0%0.93
79+172.7%+19.3%-40.8%20.2%0.9972%1.7d45,903+223.6%-47.4%0.94
80+177.1%+19.7%-39.9%20.2%1.0172%1.7d46,454+222.2%-46.7%0.94
81+182.1%+20.1%-39.3%20.1%1.0372%1.7d46,991+225.3%-46.7%0.95
82+188.0%+20.5%-39.5%20.1%1.0572%1.7d47,548+236.5%-47.0%0.97
83+184.8%+20.3%-39.6%20.1%1.0472%1.7d48,114+232.9%-47.2%0.96
84+187.7%+20.5%-39.7%20.0%1.0572%1.7d48,676+233.6%-47.8%0.97
85+191.0%+20.7%-39.4%20.0%1.0672%1.7d49,240+237.2%-47.4%0.97
86+189.3%+20.6%-39.6%20.0%1.0672%1.7d49,788+233.0%-47.7%0.97
87+190.8%+20.7%-39.7%20.0%1.0672%1.7d50,333+231.4%-48.6%0.96
88+192.7%+20.8%-39.3%19.9%1.0772%1.7d50,884+231.7%-47.9%0.97
89+190.8%+20.7%-39.6%19.9%1.0672%1.7d51,442+232.1%-48.0%0.97
90+191.0%+20.7%-39.9%19.9%1.0772%1.7d51,977+233.6%-47.9%0.97
91+185.6%+20.3%-39.9%19.9%1.0572%1.7d52,543+226.6%-47.6%0.96
92+177.3%+19.7%-40.5%19.9%1.0272%1.7d53,106+219.2%-47.8%0.94
93+177.5%+19.7%-40.4%19.9%1.0272%1.7d53,640+220.6%-47.2%0.94
94+175.6%+19.6%-40.5%19.8%1.0272%1.7d54,156+223.2%-46.4%0.95
95+180.3%+19.9%-39.5%19.8%1.0472%1.7d54,713+223.3%-46.4%0.95
96+180.4%+19.9%-39.4%19.8%1.0472%1.7d55,269+223.0%-46.7%0.95
97+177.0%+19.7%-39.9%19.7%1.0372%1.7d55,814+217.2%-46.7%0.94
98+176.4%+19.6%-40.0%19.7%1.0372%1.7d56,363+219.8%-46.7%0.95
99+176.3%+19.6%-40.1%19.7%1.0372%1.7d56,935+222.3%-46.7%0.95
100+175.5%+19.6%-39.6%19.7%1.0272%1.7d57,454+223.2%-45.7%0.95
SPY buy & hold+142.5%+16.9%-24.5%16.8%1.02100%
QQQ buy & hold+171.6%+19.3%-35.1%22.3%0.90100%

First eight metric columns are the gated strategy; the last three (lighter) are the ungated baseline pulled from the prior sweep for side-by-side comparison. Green row = best gated Sharpe (N=44); blue-tinted row = best gated return (N=6). SPY/QQQ rows are buy-and-hold over the identical window (always 100% invested, no gate). Max drawdown is close-to-close at ranking-day granularity. Time-in-market is 71.6% for every N — the gate decision is the same QQQ signal regardless of basket size.

2 · Total return vs N — gated vs ungated

Gated total return %Ungated total return %SPY B&HQQQ B&H

The gated line sits below the ungated line almost everywhere — the cash periods cost raw return. The gap is widest in the high-return mid/upper range (~N=24–100), where the ungated book rode the full recovery while the gated book sat out chunks of it. Both clear SPY across most of the range; the gated book trails QQQ on raw return at high N but wins on risk-adjusted terms (next chart).

3 · Max drawdown vs N — gated vs ungated

Gated max DD %Ungated max DD %SPY B&HQQQ B&H

Less-negative is better. The gated drawdown line is shallower than ungated across the whole sweep — the cash periods (chiefly 2022) clip the deepest losses. The improvement is largest in the mid-range (N≈24–55), where gated max DD tightens to roughly −40% vs the ungated −46–48%.

4 · Sharpe vs N — gated vs ungated

Gated SharpeUngated SharpeSPY B&HQQQ B&H

The gated Sharpe line sits above ungated across essentially the entire range — lower return but proportionally much lower volatility and drawdown nets out positive on a risk-adjusted basis. Gated Sharpe clears 1.0 across roughly N=30–90 and tops out at 1.07 (N=44), above QQQ buy-and-hold (0.90) and edging SPY (1.02) at the peak.

5 · Headline side-by-side

ConfigurationTotal returnCAGRMax DDAnn volSharpeTime in mkt
Gated N=44 best Sharpe+227.1%+23.2%-40.4%22.2%1.0772%
Ungated N=44 (ungated best)+283.2%+26.7%-46.6%28.1%1.00100%
Gated N=6 best gated return+240.7%+24.1%-65.7%30.8%0.8772%
Ungated N=6+228.8%+23.3%-76.1%36.7%0.77100%
Gated N=50 (representative)+194.2%+21.0%-42.0%21.5%1.0172%
Ungated N=50+249.0%+24.6%-46.8%27.3%0.96100%
SPY buy & hold+142.5%+16.9%-24.5%16.8%1.02100%
QQQ buy & hold+171.6%+19.3%-35.1%22.3%0.90100%

At N=44 the gate trades ~56 points of gross return for a 7-point shallower drawdown and a 0.07 higher Sharpe. The gated best-Sharpe basket beats QQQ buy-and-hold on Sharpe (0.90) and clears SPY's drawdown discipline far better than the ungated book, though still at higher volatility than either index.

6 · Per-year performance (calendar-year returns, gross, 0 bp)

Per-calendar-year total return for the ungated basket vs the QQQ 55-day VWAP gate basket, alongside SPY and QQQ buy-and-hold, at the two representative basket sizes. Each year = equity at the last ranking-day of the year over the prior year-end (2020 = Q4 partial from the 2020-10-01 start; 2026 = YTD through 2026-06-04). Year-by-year returns compound to the headline totals shown above.

N=6 — best gated raw return

YearUngatedVWAP gateSPYQQQ
2020 Q4+18.2%+11.6%+11.4%+11.4%
2021-25.4%-26.6%+28.7%+27.4%
2022-47.6%-26.0%-18.2%-32.6%
2023+61.9%+41.8%+26.2%+54.9%
2024+70.2%+73.4%+24.9%+25.6%
2025+36.3%+36.9%+17.7%+20.8%
2026 YTD+89.3%+67.2%+11.4%+20.9%

N=44 — best gated Sharpe

YearUngatedVWAP gateSPYQQQ
2020 Q4+22.9%+16.4%+11.4%+11.4%
2021+18.6%+2.6%+28.7%+27.4%
2022-27.7%-10.6%-18.2%-32.6%
2023+23.2%+15.0%+26.2%+54.9%
2024+28.4%+23.3%+24.9%+25.6%
2025+47.4%+51.5%+17.7%+20.8%
2026 YTD+55.8%+42.8%+11.4%+20.9%

The 2022 row is where the gate earns its keep. Holding cash for ~71% of the bear year, the VWAP gate cut the ungated basket's 2022 loss sharply (N=6: −47.6% → −26.0%; N=44: −27.7% → −10.6%) — beating QQQ's −32.6% in both. The cost is up-year give-back: the single-threshold VWAP whipsaws in and out, so in trending years it lags the ungated basket (N=44 2021: +18.6% → +2.6%; 2023: +23.2% → +15.0%; 2026 YTD: +55.8% → +42.8%). You pay in bull-market upside to buy a smaller drawdown in the bear — net positive on Sharpe across the window, but a larger raw-return give-up than the MA gate.

7 · Bottom line

Methodology & caveats. Base harness (unchanged): equal-weight top-N, rebalanced at the close each ranking-day; fills at same-day adjusted close (no look-ahead); N swept 1→100; gross of costs — 0 bp, no commissions or slippage. Market-holiday / data-gap days held (no rebalance); a held name with no price that day is marked to its last known close (carry). Delisted/acquired names with no yfinance price are dropped from the slot and equal-weight is redistributed among the priced names that day; ticker renames remapped (FB→META, SQ→XYZ, ANTM→ELV, DISCA→WBD, BRK.B→BRK-B, BF.B→BF-B, PBR.A→PBR-A). yfinance adjusted close folds in dividends/splits. Max drawdown measured close-to-close at ranking-day granularity (intraday deeper). QU100 rankings from local TimescaleDB money_flow_snapshots, ranking_type top100, 2020-10-01 → 2026-06-04. QU100 membership carries survivorship bias (only names QU included; fully-dropped losers don't penalize), as does the priced-universe coverage. Ungated sanity-check: this harness reproduces the prior sweep's N=3 (+171.5%) and N=5 (+208.6%) to the dollar before the gate is applied.

VWAP gate. Gate signal = QQQ 55-bar rolling VWAP from raw HLC3×volume: hlc3=(H+L+C)/3, VWAP55=Σ(hlc3·vol,55)/Σ(vol,55), computed on QQQ's own trading days. At each ranking-day the gate compares QQQ raw close to VWAP55 (raw-vs-raw, consistent basis); close ≥ VWAP55 → invested, else cash. Single threshold, no hysteresis band — state can flip daily. Pine offset=2 plot shift deliberately omitted (it would be look-ahead). QQQ OHLCV seed: QQQ raw OHLCV fetched separately from yfinance (auto_adjust=False) seeded from 2020-06-01 so VWAP55 is fully warmed (first valid 2020-08-17) before the 2020-10-01 window start. QQQ has no stock splits in this window, so raw OHLCV is contiguous and the raw close/VWAP comparison needs no split adjustment. Time-in-market 71.6% (74 flips). Not investment advice — a research backtest with known survivorship bias.