200-Day SMA Regime Filter on XLK
Technology Select Sector SPDR Fund: S&P 500 technology stocks, the sector behind most recent bull runs. Backtest 2021-01-04 to 2026-10-02, $10,000 starting capital, computed by the same engine that runs live DeployQuant strategies.
The 200-day regime filter owns a fund while yesterday's close sits above its 200-day average and holds cash while it sits below. Applied to XLK, the Technology Select Sector SPDR Fund, it grew $10,000 to $24,405 from 2021-01-04 to 2026-10-02. The CAGR was 16.81%, the total return 144.05%, the Sharpe ratio 0.98 and the maximum drawdown 19.72%.
A buy-and-hold position in XLK finished at $31,425, compounding at 22.07% with a 32.96% drawdown and a Sharpe of 0.95. The filter traded away return for a shallower drawdown and a marginally higher Sharpe. It ranks 3rd of the 12 templates on XLK by CAGR, and XLK ranks 7th of the 59 funds for this rule. For all 59 funds the rule's median CAGR is 1.84%, and for the sector group 6.52%, which leaves XLK well above both.
The rule closed 11 round trips over 23 fills, and one more position was open on the last day. Only four of the 11 were winners, 36%, and still the profit factor reached 6.87. Winners averaged 20.31% and losers averaged -1.74%. Six of the losing trades came in 2022, each small, and one trade held for 560 days and made 52.08%. That is what a regime filter looks like in numbers: many cheap exits and a few long holds. Exposure was 65.9% and the average hold was 109.8 days.
Scope: 5.74 years, a fee-free headline run and one decision per day. XLK rose in five of the six calendar years, a backdrop that favours any rule that stays invested.
Year by year
| Year | 200-day regime filter | buy & hold |
|---|---|---|
| 2021 | 10.4% | 36.1% |
| 2022 | −18.5% | −27.2% |
| 2023 | 44.4% | 54.6% |
| 2024 | 17.4% | 21.3% |
| 2025 | 19.9% | 24.3% |
| 2026 | 33.4% | 38.9% |
Calendar years against holding
The filter returned 10.4% in 2021, -18.5% in 2022, 44.4% in 2023, 17.4% in 2024, 19.9% in 2025 and 33.4% so far in 2026. Holding returned 36.1%, -27.2%, 54.6%, 21.3%, 24.3% and 38.9% over those years. Only 2022 favoured the rule, by 8.7 points. The other five years went to holding.
The rule had little time in 2021. Computing a 200-day average takes 200 sessions of data, which leaves the monthly table empty until October. The first buy was on 2021-10-19 at an adjusted $75.9, and October to December returned 2.5%, 4.34% and 3.21%. Holding earned 36.1% that year, which is why 2021 carries the widest gap in the table, 25.7 points. Almost all of it is the missing warm-up months and little of it reflects a decision.
2022 is where the filter earned its keep, with a qualification. XLK lost 27.2% and the rule lost 18.5%. The first trade, held from 2021-10-19 to 2022-01-26, lost 0.74% over 99 days. Then six short trades in a row lost money: 2.17% from 2022-01-31 to 2022-02-14, 1.97% in two days in February, 2.89% from 2022-03-25 to 2022-04-07, 0.46% in two days in August and 2.43% in three days later that month. The monthly table shows -7.99% in January, -6.17% in February, 0.36% in March, -3.15% in April and -2.81% in August. The rule sold for good on 2022-08-22 and stayed in cash through December, avoiding the fund's slide to its October low and the -5.3% day on 2022-09-13.
The qualification is that the filter still lost 18.5% in 2022. The rule was long for most of January and February, and each exit came only after price had already closed under the average. In January alone the rule lost 7.99%, its worst month of the test.
2023 returned 44.4% against 54.6%. The rule re-entered on 2023-01-24 at $65.05, which left the opening weeks of the year in cash, and the monthly table shows 1.87% in January, 10.6% in March, 8.71% in May, 5.96% in June and 12.62% in November. September returned -6.32%. That entry is the best trade of the test, held 560 days to 2024-08-06 for 52.08%. The 10.2-point gap to holding comes mostly from that late entry.
2024 returned 17.4% against 21.3%. The 560-day trade ended on 2024-08-06 at $98.93, just after the fund's early-August drop, and the rule re-bought on 2024-08-09 at $100.97 and sold on 2024-09-09 for 0.84%. It bought again on 2024-09-10 at $103.05 and held to 2025-02-28 at $109.52, a gain of 6.28%. April 2024 returned -5.69%, May 7.05% and June 7.64%.
2025 returned 19.9% against 24.3%, and the way it did so is the clearest evidence of what the filter does. The rule left on 2025-02-28, which kept it out of March and April, when the fund fell 25.29% from its 2025-02-18 peak to the 2025-04-08 low. It also missed 2025-04-09, the fund's best day at 13.37%, and re-entered on 2025-05-13 at $113.28. June returned 9.61%, September 7.4% and October 6.47%. The 4.4-point shortfall mostly reflects that cash period.
2026 returned 33.4% against 38.9%. The trade that began on 2025-05-13 ended on 2026-03-16 at $138.23 for 22.03%. The rule bought back the next day at $138.91 and sold on 2026-03-23 at $136.82 for -1.5%, a one-week whipsaw. It bought again on 2026-04-09 at $141.37, and that position was up 41.37% at the close of the data. April returned 12.19% and May 19.43%, the best month of the test. July returned -7.8% as XLK fell.
Month by month
| Year | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2021 | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 2.5% | 4.3% | 3.2% |
| 2022 | −8.0% | −6.2% | 0.4% | −3.1% | 0.0% | 0.0% | 0.0% | −2.8% | 0.0% | 0.0% | 0.0% | 0.0% |
| 2023 | 1.9% | 0.4% | 10.6% | −0.1% | 8.7% | 6.0% | 2.5% | −1.5% | −6.3% | 0.1% | 12.6% | 4.1% |
| 2024 | 2.6% | 4.6% | 0.8% | −5.7% | 7.0% | 7.6% | −3.3% | −1.4% | 1.4% | −1.5% | 5.0% | −0.3% |
| 2025 | −0.7% | −4.1% | 0.0% | 0.0% | 1.0% | 9.6% | 3.6% | 0.0% | 7.4% | 6.5% | −4.7% | 0.7% |
| 2026 | −0.1% | −3.5% | −1.5% | 12.2% | 19.4% | −0.2% | −7.8% | 6.2% | 5.0% | 2.1% | – | – |
The monthly grid
The grid carries zeros in three places. January to September 2021 is the warm-up, May to July and September to December 2022 are the bear-market months in cash, and March and April 2025 are the third block. In every other month the rule owned the fund and its monthly figures follow XLK.
May 2026 gave the rule its top month at 19.43%, ahead of November 2023 at 12.62% and April 2026 at 12.19%. The worst was January 2022 at -7.99%, then July 2026 at -7.8% and February 2022 at -6.17%. For holding, April 2026 was the best at 19.71% and September 2022 the worst at -11.65%. The rule's own September 2022 was a zero, which spared it the fund's worst month.
The rule's worst months were January 2022, July 2026, September 2023, February 2022 and April 2024, and in each one the position was open when the fund turned. A filter on a slow average cannot exit before the turn happens. It exits when the price has already moved under the line.
XLK's month-of-year averages show May at 7.38%, November at 4.79%, October at 4.19% and June at 3.52% as the strongest, with September at -1.48% and February at -0.7% the weakest. Five or six years stand behind each average and the rule ignores the calendar, so these describe the window and nothing more.
Every trade
200-day regime filter on XLK made 11 closed round trips and one position still open at the end of the test, an average hold of 110 days, an average winner of 20.31%, an average loser of −1.74%, a profit factor of 6.87, a longest losing streak of 6. It held a position at the close on 65.9% of trading days.
| Entry | Entry price | Exit | Exit price | Return | Days held |
|---|---|---|---|---|---|
| 2021-10-19 | $75.90 | 2022-01-26 | $75.34 | −0.7% | 99 |
| 2022-01-31 | $76.40 | 2022-02-14 | $74.74 | −2.2% | 14 |
| 2022-02-16 | $76.14 | 2022-02-18 | $74.64 | −2.0% | 2 |
| 2022-03-25 | $76.58 | 2022-04-07 | $74.37 | −2.9% | 13 |
| 2022-08-16 | $73.14 | 2022-08-18 | $72.80 | −0.5% | 2 |
| 2022-08-19 | $72.54 | 2022-08-22 | $70.78 | −2.4% | 3 |
| 2023-01-24 | $65.05 | 2024-08-06 | $98.93 | 52.1% | 560 |
| 2024-08-09 | $100.97 | 2024-09-09 | $101.82 | 0.8% | 31 |
| 2024-09-10 | $103.05 | 2025-02-28 | $109.52 | 6.3% | 171 |
| 2025-05-13 | $113.28 | 2026-03-16 | $138.23 | 22.0% | 307 |
| 2026-03-17 | $138.91 | 2026-03-23 | $136.82 | −1.5% | 6 |
| 2026-04-09 | $141.37 | open | – | 41.4% | – |
Prices are adjusted for splits and dividends, so they sit below the quotes printed at the time. An open position is marked at the last close.
The 11 closed trades and the open one
The shape of the distribution explains the profit factor. Seven of the 11 closed trades lost, and none lost more than 2.89%. The four winners were 52.08%, 22.03%, 6.28% and 0.84%. The median closed trade lost 0.74% and the median hold was 14 days, while the longest hold was 560 days and the shortest was 2.
The five best trades were 52.08% (2023-01-24 to 2024-08-06, $65.05 to $98.93, 560 days), 22.03% (2025-05-13 to 2026-03-16, $113.28 to $138.23, 307 days), 6.28% (2024-09-10 to 2025-02-28, 171 days), 0.84% (2024-08-09 to 2024-09-09, 31 days) and -0.46% (2022-08-16 to 2022-08-18, 2 days). The fifth is a loss because the test had only four winners. Prices are adjusted for splits and dividends, so they run below the quotes printed at the time.
The five worst were -2.89% (2022-03-25 to 2022-04-07, 13 days), -2.43% (2022-08-19 to 2022-08-22, 3 days), -2.17% (2022-01-31 to 2022-02-14, 14 days), -1.97% (2022-02-16 to 2022-02-18, 2 days) and -1.5% (2026-03-17 to 2026-03-23, 6 days). Four of the five came in 2022, and the fifth is the March 2026 whipsaw. Each loss is small because the exit comes when price closes under the average, which on a sector fund that moves 1.77% in a typical day is often within a few points of the entry.
Grouped by exit year: six round trips and no wins in 2022, two trips and two wins in 2024, one trip and one win in 2025, two trips and one win in 2026. No trade closed in 2021 or 2023. Wins came at most 4 in a row and losses at most 6 in a row, the 2022 run.
The open position is the largest unrealised number in the table. It was bought on 2026-04-09 at $141.37 and showed a gain of 41.37% at the end of the data. It sits outside the 11 round trips and the win rate, and the statistics will shift once it closes.
Eleven round trips on 23 fills is a low count. The 36% win rate rests on only 11 trades, six of which came in a single year.
Largest drawdowns
| Peak | Low point | Depth | Days to low | Recovered | Days to recover |
|---|---|---|---|---|---|
| 2021-12-27 | 2022-08-22 | −19.7% | 238 | 2023-06-02 | 284 |
| 2024-07-10 | 2024-08-05 | −16.4% | 26 | 2025-06-30 | 329 |
| 2026-06-02 | 2026-07-29 | −15.6% | 57 | 2026-10-01 | 64 |
Buy-and-hold's deepest drawdown ran from 2021-12-27 to 2022-10-12 and reached −33.0%.
Drawdowns for the rule and for the fund
The deepest drawdown for the rule was 19.72%: peak 2021-12-27, trough 2022-08-22 (238 days on), recovery 2023-06-02 (284 days after the trough). Holding saw 32.96% from that same peak down to 2022-10-12, with a recovery on 2023-06-15. The rule's worst fall was 13.24 points shallower, and it recovered earlier, on 2023-06-02 against 2023-06-15.
That first drawdown is made of the January and February 2022 losses, since the rule was long when the fund started to fall and the exit came late. The filter saved the account from the remaining slide, which for the fund ran from the August levels into October.
The second drawdown was 16.44%, from 2024-07-10 to 2024-08-05 over 26 days, and it took 329 days to recover on 2025-06-30. The drop was fast, the exit came on 2024-08-06, a day after the trough, and the rule re-bought on 2024-08-09 at a higher price. The third was 15.6%, from 2026-06-02 to 2026-07-29 over 57 days, recovered on 2026-10-01 after 64 days. That one follows the May 2026 peak month and July's -7.8%.
Holding's next two drawdowns were 25.29% (2025-02-18 to 2025-04-08, back to the peak on 2025-06-12) and 16.74% (2024-07-10 to 2024-08-07, back on 2024-11-07). The rule avoided the 2025 episode completely, which does not appear in its list of three, and it shared the 2024 one nearly in full: 16.44% against 16.74%. The filter helped where the decline was slow and did little where it was a sudden break.
Sharpe was 0.98 for the rule and 0.95 for holding. A rule with 65.9% exposure had a drawdown far shallower than the fund, and still earned a Sharpe slightly higher than holding, which means the volatility saved was worth about what the return surrendered.
With trading costs
The headline run fills at the bar price. These runs charge slippage on every fill.
| Slippage per fill | CAGR | Max drawdown | Final value | Sharpe |
|---|---|---|---|---|
| None (headline) | 16.8% | −19.7% | $24,405 | 0.98 |
| 5 basis points | 16.6% | −20.1% | $24,152 | 0.96 |
| 10 basis points | 16.3% | −20.6% | $23,838 | 0.95 |
Slippage runs
Costs are zero in the headline run. A 5 basis point slippage charge on every fill gives a CAGR of 16.6%, a drawdown of 20.15%, a Sharpe of 0.965 and an end value of $24,152. At 10 basis points the CAGR was 16.34%, the drawdown 20.61%, the Sharpe 0.953 and the end value $23,838. The headline CAGR was 16.81%.
The cost shows up in the many small 2022 trades, each of which pays slippage on entry and exit. With 23 fills in 5.74 years the drag is small. XLK turns over about $1,324,049,811 on an average day, with 20,984 shares in the median minute, and a $10,000 sleeve disappears inside that flow. Both runs apply a flat per-fill charge and skip the quoted spread.
Changing the parameters
| Version | CAGR | Max drawdown | Round trips | Win rate | Final value |
|---|---|---|---|---|---|
| Published rules | 16.8% | −19.7% | 11 | 36% | $24,405 |
| 100-day SMA | 14.0% | −29.4% | 30 | 37% | $21,180 |
| 150-day SMA | 8.7% | −36.7% | 20 | 25% | $16,126 |
| 250-day SMA | 14.0% | −22.4% | 9 | 22% | $21,204 |
Other averaging windows
Each variant swaps in a different average length. The 100-day window returned 13.96% a year with a 29.42% drawdown, 30 trades and 11 wins, ending at $21,180. The 150-day window returned 8.68% with a 36.69% drawdown, 20 trades and 5 wins, ending at $16,126. The 250-day window returned 13.99% with a 22.35% drawdown, 9 trades and 2 wins, ending at $21,204. The standard 200-day window made 16.81% with a 19.72% drawdown, 11 trades and 4 wins.
On CAGR, drawdown and Sharpe, the 200-day window ranked first among the four. The 150-day window did worst on all three. A shorter and a longer window both did better than 150, so the results do not move in a line with the window length. That pattern points to a handful of events deciding each result and not a smooth relationship.
The 100-day window traded far more, 30 times, and its wins were 11, a better win rate than any other variant, but each win was small. The 250-day window had nine trades and the second-shallowest drawdown. All four variants returned less than holding's 22.07%.
The 200-day window came out on top here, and it is the standard setting too, so it was not selected after the fact. One fund and one window cannot say that 200 days is better than 250 on another sector or another period.
How XLK behaved
| Measure | XLK |
|---|---|
| Data in this test | 2021-01-04 to 2026-10-02 (1444 sessions) |
| Total return, buy and hold | 226.1% |
| Annualized volatility | 25.1% |
| Deepest drawdown | −33.6% (2021-12-27 to 2022-10-12) |
| Up days | 55.2% |
| Average daily range | 1.77% |
| Average overnight gap | 0.69% |
| Correlation to SPY | 0.91 |
| Correlation to QQQ | 0.97 |
| Correlation to TLT | 0.07 |
| Sessions above the 200-day average | 76.5% |
| Crossings of the 200-day average | 22 |
| Falls of 10% or more from a 20-day high | 30 |
How XLK behaved
On its own profile XLK gained 226.13%, a CAGR of 22.86%, at annualized volatility of 25.13%. The worst fall was 33.58% (2021-12-27 to 2022-10-12, regained 2023-06-15) and the longest spell under water ran 368 sessions. Up days made up 55.23% of sessions, averaging 1.15%, against -1.21% on down days. A typical day spanned 1.77% from low to high and opened 0.69% away from the prior close. Overnight moves supplied 55.3% of the return.
Year by year the fund returned 36.99%, -27.73%, 56.01%, 21.64%, 24.61% and 39.31% (2026 to date) from 2021 on. Beta to SPY is 1.39 and to QQQ 1.08, at correlations of 0.91 and 0.97, and correlation with TLT is 0.07. The fund tracks the Nasdaq-100 more closely than the broad market, and the QQQ page shows the neighbouring large-cap growth fund.
For this rule the key figure is time above the line: 76.47% of sessions closed over the 200-day average, and price crossed it 22 times. The fund spent about three sessions in four on the invested side of the line, which lets the filter hold for long stretches, and the 22 crossings are the source of every entry and exit in the trade list. Drops of 10% or more from a 20-day high happened 30 times, covering 96 days.
After the 15 sessions with RSI(14) under 30, the median 5-day return was 4.01% (baseline 0.5%) and the median 20-day return 4.4% (baseline 1.9%). RSI(14) was over 70 on 153 sessions. RSI(2) closed under 10 on 137 sessions and the median forward returns were 0.6% over 5 days and 2.59% over 20. Rebounds after oversold readings were above the baseline, a pattern that a trend filter does not trade, since it waits for price to be back over the average.
The best days were 13.37% on 2025-04-09, 8.23% on 2022-11-10 and 5.52% on 2026-07-30. The three worst were -6.76% (2025-04-03), -6.67% (2026-06-05) and -6.57% (2025-04-04). Two of the three worst days sit in the April 2025 episode that the rule skipped.
Among sector funds, the same rule returned 19.21% on SOXX, 6.52% on VOX, 2.06% on XLF, -0.81% on XLP and -2.16% on XLY. XLP and XLY made 37 and 30 round trips against 11 for XLK, which is the whipsaw pattern when a fund crosses the average often. XLK's drawdown of 19.72% was the shallowest of the group, while SOXX's was 39.17%.
The rules
Own the asset when price closes above its 200-day average; hold cash when it closes below.
- WHEN the market opens · IF not invested AND yesterday's close > SMA(200) · THEN buy with 98% of the sleeve
- WHEN the market opens · IF invested AND yesterday's close < SMA(200) · THEN sell the whole position
One rule and one number. Price above the 200-day moving average has historically coincided with better returns and lower volatility than price below it. This template uses no crossovers and no oscillators, only which side of the long-term average the price is on.
Good for: a first systematic strategy, simple enough to audit every trade.
Watch out: price whips around the 200-day line during volatile bottoms, generating clusters of buy-sell pairs. Some traders add a small buffer band to reduce churn.
Why the filter suits a trending technology fund
Two conditions are tested at the open. Flat after a close over the 200-day average: buy using 98% of the sleeve. Invested after a close under it: sell the lot. The template describes this as one rule and one number, with no crossover or oscillator.
The template warns of price chopping around the line near volatile bottoms, which creates clusters of buy and sell pairs. XLK shows such a cluster in 2022: six round trips between January and August, each lasting between 2 and 14 days, all losers. It also shows the other side. When XLK trended, the rule held 560 days, 307 days and 171 days, and those three trades made 52.08%, 22.03% and 6.28%.
The other templates on XLK show where the filter stands. The monthly cycle took 20.86% with a 32.05% drawdown and the weekly 7% target 20.39% with 20.67%. The golden cross made 15.33% with 19.6% and the trend with trailing stop 12.49% with 32.53%. The RSI(2) snapback reached 12.11% with 18.15%, the momentum breakout 11.62%, the EMA 12/26 trend 9.84%, the SMA 10/50 trend 9.47%, RSI mean reversion 8.74%, with the dip buyer at 7.85% and 3-month momentum at 6.06% at the bottom.
The golden cross is the nearest relative, using a slower pair of averages, and it earned 15.33% against 16.81% here with almost the same drawdown. The two faster trend rules, the EMA at 9.84% and the SMA 10/50 at 9.47%, earned less, so among these trend rules the slower signal did better on XLK. Two templates beat it on return, the weekly 7% target and the monthly cycle, and the monthly cycle did so with a deeper drawdown. The filter's advantage is the 19.72% drawdown with only 11 trades, which is simple to audit. Every template on the fund sits on the XLK fund page, and the 200-day regime filter page covers the rule on all 59 funds.
Where the test stops: a single sector fund, one stretch of 5.74 years holding one bear market, a fee-free headline, daily decisions, and a last position that has not closed.
Build it from blocks (or type it in English), backtest it on 5.7 years of minute data in seconds, tweak any parameter, then paper trade it on live data. No card, no broker needed to start.
Frequently asked questions
Did 200-day regime filter beat buy-and-hold on XLK?
Over 2021-01-04 to 2026-10-02, 200-day regime filter on XLK returned 16.8% annualized vs 22.1% for buy-and-hold: it trailed buy-and-hold by 5.3% per year, with a maximum drawdown 13.2 points shallower than holding (19.7% vs 33.0%).
How many trades did it make?
11 completed round trips over 5.7 years (23 fills), with 36% of round trips closing profitably.
Why the 200-day average specifically?
It approximates a year of trading days and has been studied across decades of data. It is not the best window for every asset. The per-ETF backtests here show where it helped and where it didn't.
What did the 200-day filter return on XLK?
Between 2021-01-04 and 2026-10-02 it took $10,000 to $24,405, a CAGR of 16.81% with a 19.72% maximum drawdown and a Sharpe of 0.98. Holding earned 22.07% a year with a 32.96% drawdown. Among 12 templates on XLK, the filter ranks 3rd.
Did the filter beat buy-and-hold on XLK?
On return, no. It finished behind in every year except 2022, when it lost 18.5% against 27.2% for holding. It had a shallower drawdown, 19.72% against 32.96%, and a similar Sharpe at 0.98 against 0.95.
Why is the win rate only 36% with a profit factor of 6.87?
Seven of the 11 closed trades lost, but none lost more than 2.89%, while the four winners averaged 20.31%. One trade held for 560 days and made 52.08%. A string of small losses and a few big gains produce that mix of low win rate and high profit factor.
What happened in 2022?
The rule made six losing round trips between January and August, each between 0.46% and 2.89%, and then sold on 2022-08-22 and stayed in cash through December. The year returned -18.5% against -27.2% for holding. The drawdown was 19.72%.
Did another average length do better?
The 100-day window returned 13.96% and the 250-day 13.99%, while the 150-day returned 8.68%, against 16.81% for the 200-day. They are three extra runs on a single fund and period.
Is cost a factor on XLK?
Barely. At 5 basis points per fill the CAGR was 16.6%, at 10 it was 16.34%, and with none it was 16.81%. There were 23 fills in the window.
Is a trade still open?
Yes. A buy on 2026-04-09 at an adjusted $141.37 was showing 41.37% when the data stops. It is excluded from the 11 closed round trips.
Related
Backtests are hypothetical, computed by DeployQuant's engine on minute-resolution consolidated US market data (2021-01-04 to 2026-10-02, $10,000 starting capital, no margin, no fees or slippage in the headline run; buy-and-hold puts 98% of the account in at the first open, as the templates do) and do not guarantee future results. Nothing on this page is investment advice. Live trading involves risk of loss.