200-Day SMA Regime Filter on XLY
Consumer Discretionary Select Sector SPDR Fund: consumer discretionary stocks, a cyclical read on the US consumer. 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 lost money on XLY, the Consumer Discretionary Select Sector SPDR Fund. From 2021-01-04 to 2026-10-02 a $10,000 account ended at $8,821, a CAGR of -2.16%, with a maximum drawdown of 27.27% and a Sharpe ratio of -0.09. Holding XLY across the window ended at $14,177 on 6.27% a year, though its worst drawdown was 39.06% and its Sharpe ratio was 0.39. The rule gave back 8.43 points a year of return against holding and took a drawdown that was 11.79 points shallower.
The account holds XLY after any close above the 200-day average and holds cash after any close below it. It was invested on 56.1% of days. It closed 30 round trips and only 7 won, a win rate of 23%, with 60 fills. The average winner gained 4.69% and the average loser lost 1.9%, which gives a profit factor of 0.7. The median hold was 6 days, the average was 39.3 and the longest was 287. The longest losing streak was 9 trades.
Among the 12 templates on XLY the regime filter placed 10th. The weekly 7% target led at 10.19%, followed by the RSI(2) snapback at 8.2% and RSI mean reversion at 7%. Only the 3-month momentum rule at -3.94% and the trend plus trailing stop at -4.4% did worse. Across the 59 funds this rule placed 41st.
All figures come from one 5.74-year window, and the headline run charges nothing for trading. The full set of templates for this fund is on the XLY hub.
Year by year
| Year | 200-day regime filter | buy & hold |
|---|---|---|
| 2021 | 6.7% | 28.5% |
| 2022 | −18.6% | −35.7% |
| 2023 | 7.4% | 38.7% |
| 2024 | 18.2% | 26.0% |
| 2025 | −6.1% | 7.3% |
| 2026 | −14.8% | −7.2% |
What each year looked like
The rule beat holding in 2022 and lost to it in the other five years. It returned 6.7% in 2021, -18.6% in 2022, 7.4% in 2023, 18.2% in 2024, -6.1% in 2025 and -14.8% in the partial 2026. XLY returned 28.5%, -35.7%, 38.7%, 26%, 7.3% and -7.2%. The 2022 lead was 17.1 points. The 2023 shortfall was 31.3 points and the 2021 shortfall was 21.8.
The rule held nothing until October 2021. The 200-day average needs 200 sessions of history, and the first trade, from 2021-10-19 to 2022-01-21, lost 3.22% over 94 days. October and November 2021 gained 4.82% and 1.6% for the rule, and the year finished at 6.7% while the fund made 28.5%. The fund made 28.5% that year, and the rule held nothing for its first nine months.
2022 was the year that worked. January lost 9.19%, February lost 4.85%, March lost 3.26% and April lost 2.6%. Then the rule went to cash. It made four short round trips in a row, 1 day, 2 days, 3 days and 1 day, and lost on each, the last on 2022-04-06. From May through December 2022 it held nothing and the fund kept falling to its low on 2022-12-28. The rule lost 18.6% for the year and the fund lost 35.7%. No trade closed in 2022 with a gain, five trades and no wins.
2023 returned 7.4% against 38.7% for the fund, the widest gap in the test. The rule bought again on 2023-02-01 and then moved in and out around the 200-day line for three months, with eight closed trades that year and two wins. Between 2023-02-01 and 2023-05-04 it closed 7 trades and lost on all but one, a 0.27% winner. The 2023-05-08 entry held until 2023-10-20 for 4.26%, and June 2023 made 11.94%. September and October lost 5.42% and 4.71%.
2024 was the best year for the rule at 18.2%, against 26% for the fund. The trade from 2023-11-03 to 2024-04-22 returned 6.95% over 171 days. A trade from 2024-04-24 to 2024-08-06 lost 1.67%, and the entry on 2024-08-14 at an adjusted 87.5 held until 2025-03-11 at 97.65 for 11.6%, the best trade of the test after 209 days. November 2024 made 12.67%, the rule's best month.
2025 returned -6.1% while the fund returned 7.3%. The 2024 trade closed on 2025-03-11 with its gain, yet February lost 6.89% and March lost 13.12%, the worst month of the test. A trade on 2025-03-25 at 101.21 lost 5.69% in 6 days and was the worst trade. April 2025 shows 0.0% because the rule was in cash. The entry on 2025-05-13 at 105.29 held to 2026-02-24 at 114.68 for 8.92% over 287 days, the longest hold.
2026 runs to 2026-10-02. The rule lost 14.8% and the fund lost 7.2%, so the rule was worse than holding even in a year when the fund fell. Thirteen trades closed in 2026 and 3 of them won, counting the long trade that ended on 2026-02-24. The monthly figures were -5.1% in February, -3.85% in March, 1.57% in April, 1.31% in May, -4.07% in June, -3.47% in July, -2.22% in August and -1.26% in September.
The yearly table shows two kinds of year. In years with a long trend, either up or down, the rule did what it is built to do. In years that moved across the 200-day line again and again, 2023 and 2026 in particular, it paid a small loss each time and finished well behind. A rule with no buffer around the line has no way to avoid that.
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% | 4.8% | 1.6% | 0.2% |
| 2022 | −9.2% | −4.8% | −3.3% | −2.6% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% |
| 2023 | 0.0% | −1.4% | 1.0% | −5.9% | 1.3% | 11.9% | 2.3% | −1.7% | −5.4% | −4.7% | 5.4% | 6.0% |
| 2024 | −4.3% | 7.7% | −0.1% | −6.9% | 0.2% | 3.8% | 2.7% | −3.8% | 7.2% | −1.7% | 12.7% | 1.1% |
| 2025 | 3.4% | −6.9% | −13.1% | 0.0% | 0.3% | 1.8% | 1.8% | 4.5% | 3.5% | 0.1% | −1.4% | 1.1% |
| 2026 | 1.4% | −5.1% | −3.9% | 1.6% | 1.3% | −4.1% | −3.5% | −2.2% | −1.3% | 0.0% | – | – |
What the month table shows
The monthly table has a long block of zeros. The rule held nothing from January to September 2021, from May to December 2022, in January 2023 and in April 2025. Those 0.0% cells are cash months. The rule's best month was November 2024 at 12.67% and its worst was March 2025 at -13.12%. Holding the fund had a best month of 17.99% in July 2022 and a worst of -11.72% in April 2022.
The rule missed the fund's best month entirely. July 2022 was a 17.99% month for holding XLY, and the rule was in cash for it. The fund's worst month was April 2022 at -11.72%, and the rule lost 2.6% in that month before going to cash on 2022-04-06.
Gains were concentrated. June 2023 made 11.94%, February 2024 made 7.68%, September 2024 made 7.2% and November 2023 and 2024 made 5.38% and 12.67%. Losses were more frequent and more widely spread: April 2023 lost 5.93%, April 2024 lost 6.9%, and January 2022 lost 9.19%. April was a weak month for the rule in 2022, 2023 and 2024.
The fund's average return by calendar month came to 5.12% in November, 4.24% in July and -1.9% in September, from 5 or 6 observations each. The rule lost 5.42% in September 2023 and 3.77% in August 2024 but made 7.2% in September 2024, which does not follow the fund's average. With so few observations per month, these averages describe this window only.
Every trade
200-day regime filter on XLY made 30 closed round trips, an average hold of 39 days, an average winner of 4.69%, an average loser of −1.90%, a profit factor of 0.70, a longest losing streak of 9. It held a position at the close on 56.1% of trading days.
| Entry | Entry price | Exit | Exit price | Return | Days held |
|---|---|---|---|---|---|
| 2021-10-19 | $91.88 | 2022-01-21 | $88.92 | −3.2% | 94 |
| 2022-02-02 | $89.76 | 2022-02-03 | $86.74 | −3.4% | 1 |
| 2022-02-09 | $90.89 | 2022-02-11 | $89.38 | −1.7% | 2 |
| 2022-03-29 | $92.04 | 2022-04-01 | $89.59 | −2.7% | 3 |
| 2022-04-05 | $90.69 | 2022-04-06 | $87.67 | −3.3% | 1 |
| 2023-02-01 | $71.76 | 2023-02-22 | $70.74 | −1.4% | 21 |
| 2023-03-06 | $70.99 | 2023-03-07 | $70.30 | −1.0% | 1 |
| 2023-03-31 | $71.24 | 2023-04-06 | $70.07 | −1.6% | 6 |
| 2023-04-12 | $71.31 | 2023-04-13 | $70.30 | −1.4% | 1 |
| 2023-04-14 | $71.18 | 2023-04-21 | $71.37 | 0.3% | 7 |
| 2023-04-24 | $71.83 | 2023-04-26 | $70.48 | −1.9% | 2 |
| 2023-04-28 | $71.55 | 2023-05-04 | $70.78 | −1.1% | 6 |
| 2023-05-08 | $71.67 | 2023-10-20 | $74.72 | 4.3% | 165 |
| 2023-11-03 | $77.98 | 2024-04-22 | $83.40 | 7.0% | 171 |
| 2024-04-24 | $85.70 | 2024-08-06 | $84.27 | −1.7% | 104 |
| 2024-08-14 | $87.50 | 2025-03-11 | $97.65 | 11.6% | 209 |
| 2025-03-25 | $101.21 | 2025-03-31 | $95.45 | −5.7% | 6 |
| 2025-05-13 | $105.29 | 2026-02-24 | $114.68 | 8.9% | 287 |
| 2026-02-25 | $116.70 | 2026-03-04 | $114.63 | −1.8% | 7 |
| 2026-03-05 | $115.49 | 2026-03-09 | $112.39 | −2.7% | 4 |
| 2026-04-15 | $115.95 | 2026-05-18 | $115.91 | −0.0% | 33 |
| 2026-05-21 | $116.87 | 2026-06-04 | $117.33 | 0.4% | 14 |
| 2026-06-16 | $117.92 | 2026-06-18 | $115.93 | −1.7% | 2 |
| 2026-07-01 | $117.44 | 2026-07-09 | $114.58 | −2.4% | 8 |
| 2026-07-13 | $117.04 | 2026-07-14 | $115.83 | −1.0% | 1 |
| 2026-07-17 | $115.95 | 2026-07-20 | $115.79 | −0.1% | 3 |
| 2026-08-04 | $117.59 | 2026-08-18 | $115.96 | −1.4% | 14 |
| 2026-08-20 | $116.49 | 2026-08-21 | $117.00 | 0.4% | 1 |
| 2026-08-24 | $118.02 | 2026-08-28 | $116.36 | −1.4% | 4 |
| 2026-08-31 | $116.25 | 2026-09-01 | $114.85 | −1.2% | 1 |
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 trades behind the result
None of the 30 round trips was still open at the end. The middle trade lost 1.41%. The median hold was 6 days. Most of the 30 are short entries after a close above the 200-day line, followed by a close below it a few days later. The losses ranged from 0.03% to 5.69%, and they add up.
The five best trades were 11.6% from 2024-08-14 to 2025-03-11, 8.92% from 2025-05-13 to 2026-02-24, 6.95% from 2023-11-03 to 2024-04-22, 4.26% from 2023-05-08 to 2023-10-20 and 0.44% from 2026-08-20 to 2026-08-21. The first four held for 209, 287, 171 and 165 days. The fifth lasted one day. Only 7 trades won, and the four long ones are the largest.
The worst trades were -5.69% from 2025-03-25 to 2025-03-31, -3.36% from 2022-02-02 to 2022-02-03, -3.33% from 2022-04-05 to 2022-04-06, -3.22% from 2021-10-19 to 2022-01-21 and -2.68% from 2026-03-05 to 2026-03-09. Three of the five lasted four days or fewer. Each buy comes at the open after a close above the average.
Win rate is 23% and profit factor is 0.7. The average win of 4.69% is larger than the average loss of 1.9%, which is typical of a trend rule, but the losing trades outnumber the winners by far. Two wins in a row was the best streak and nine losses in a row was the worst. By exit year, 2022 had 5 trades and 0 wins, 2023 had 8 and 2, 2024 had 2 and 1, 2025 had 2 and 1, and 2026 had 13 and 3. Listed prices are adjusted and sit under the day's quotes.
The count of trades follows the price's behavior around the line. XLY crossed its 200-day average 59 times in the window. That is a high count for a fund that closed above the average on 65.06% of sessions. Each crossing is a chance for a buy or a sell, and the rule acted on most of them in 2023 and 2026.
Largest drawdowns
| Peak | Low point | Depth | Days to low | Recovered | Days to recover |
|---|---|---|---|---|---|
| 2021-11-19 | 2023-05-03 | −27.3% | 530 | 2024-12-04 | 581 |
| 2024-12-17 | 2026-09-01 | −24.8% | 623 | not yet | – |
| 2021-11-05 | 2021-11-11 | −3.8% | 6 | 2021-11-19 | 8 |
Buy-and-hold's deepest drawdown ran from 2021-11-19 to 2022-12-28 and reached −39.1%.
What the drawdowns looked like
The rule's deepest drawdown was 27.27%. It began at a peak on 2021-11-19, reached a low on 2023-05-03 after 530 days and recovered on 2024-12-04 after 581 more. Holding the fund had a 39.06% drawdown from the same peak date, with a low on 2022-12-28 and a recovery on 2024-11-06. The rule's low came later, because the whipsaw trades of early 2023 kept eroding the account after the fund had stopped falling.
The second drawdown was 24.81%, from 2024-12-17 to 2026-09-01, 623 days to the low, with no recovery by the end of the data. Holding XLY from that same 2024-12-17 peak lost 25.64% by 2025-04-08 and was back to even on 2025-09-12, 157 days later. The fund recovered in 2025 and the rule's account did not. It lost 13.12% in March 2025 and then took a run of small losses through 2026.
The third was a 3.76% drawdown from 2021-11-05 to 2021-11-11, recovered on 2021-11-19. Holding the fund had a third drawdown of 14.79% from 2026-01-12 to 2026-03-30, with no recovery by the end of the data. The rule's maximum drawdown was 11.79 points shallower than the fund's. The cash months of 2022 are where the rule's path split from the fund's.
A regime filter is meant to protect against long declines, and the 2022 figures show that: 27.27% against 39.06%. The same rule then spent 623 days falling in its second drawdown, and at the end of the data it had not recovered.
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) | −2.2% | −27.3% | $8,821 | -0.09 |
| 5 basis points | −2.7% | −28.0% | $8,564 | -0.13 |
| 10 basis points | −3.1% | −28.9% | $8,329 | -0.16 |
Slippage runs
Headline figures assume free fills. Charging 5 basis points on each fill pushes the CAGR to -2.66%, the maximum drawdown rose to 28.02%, the end equity was $8,564 and the Sharpe ratio was -0.128. At 10 basis points the CAGR was -3.13%, the drawdown 28.87%, the end equity $8,329 and the Sharpe ratio -0.163.
The rule made 60 fills in 5.74 years, and the median trade lasted 6 days. Each short trade pays the cost on entry and on exit and earns very little in between, so a rule that already loses money loses faster as costs are added. The result moves from -2.16% to -3.13% at the higher assumption, still far below the fund's 6.27%.
XLY trades heavily, at $892,144,651 of average daily dollar volume and 15,102 shares in the median minute. Orders from a $10,000 account are tiny beside that, and no larger size was tested.
Changing the parameters
| Version | CAGR | Max drawdown | Round trips | Win rate | Final value |
|---|---|---|---|---|---|
| Published rules | −2.2% | −27.3% | 30 | 23% | $8,821 |
| 100-day SMA | 1.7% | −24.3% | 27 | 26% | $10,989 |
| 150-day SMA | −0.5% | −24.4% | 34 | 24% | $9,717 |
| 250-day SMA | −3.5% | −29.2% | 36 | 25% | $8,172 |
Other average lengths
Three variants changed the length of the average. The 100-day version made 27 trades with 7 wins, a CAGR of 1.66%, a drawdown of 24.34%, an end equity of $10,989 and a Sharpe ratio of 0.187. It is the only variant that finished with a gain. The 150-day version made 34 trades with 8 wins, a CAGR of -0.5%, a drawdown of 24.43%, an end equity of $9,717 and a Sharpe ratio of 0.034.
The 250-day version made 36 trades with 9 wins, a CAGR of -3.45%, a drawdown of 29.17%, an end equity of $8,172 and a Sharpe ratio of -0.179. It lost more than the published 200-day rule. Moving from 100 days to 250 days took the CAGR from 1.66% to -3.45%, with the trade count climbing from 27 to 36.
On this fund a shorter average did better and a longer one did worse, and none of the three beat holding at 6.27%. The pattern holds across the three settings, but it is one window on one fund. The 100-day average is the only setting here to finish above $10,000, and choosing it after the fact would be fitting to this window.
How XLY behaved
| Measure | XLY |
|---|---|
| Data in this test | 2021-01-04 to 2026-10-02 (1444 sessions) |
| Total return, buy and hold | 44.7% |
| Annualized volatility | 23.3% |
| Deepest drawdown | −39.7% (2021-11-19 to 2022-12-28) |
| Up days | 53.0% |
| Average daily range | 1.68% |
| Average overnight gap | 0.63% |
| Correlation to SPY | 0.87 |
| Correlation to QQQ | 0.86 |
| Correlation to TLT | 0.11 |
| Sessions above the 200-day average | 65.1% |
| Crossings of the 200-day average | 59 |
| Falls of 10% or more from a 20-day high | 24 |
How XLY behaved and what that meant for the filter
XLY holds consumer discretionary stocks and reads as a cyclical view of the US consumer. It returned 44.67% on a price basis in the window, a CAGR of 6.64%, with annualized volatility of 23.32%. Its worst fall was 39.67%, from 2021-11-19 to 2022-12-28, recovered on 2024-11-06, and its longest drawdown covered 743 sessions. Calendar returns ran from -36.28% in 2022 to 39.68% in 2023, with 26.51% in 2024, 7.36% in 2025 and -7.26% in the partial 2026.
The fund is a high-beta equity fund. Its beta to SPY was 1.24, to QQQ 0.89 and to TLT 0.16, and its correlations to those three were 0.87, 0.86 and 0.11. VV, SSO, SPY, VOO and SPUU sat between 0.87 and 0.88. SDS, SH and SPDN were the mirror at -0.87.
XLY closed higher on 53.01% of sessions. Its up days averaged 1.06% and its down days averaged -1.13%, inside a typical range of 1.68% from low to high. The largest one-day gain came on 2025-04-09 at 10.79%, and the largest loss on 2022-05-18 at -6.54%. Most of the log return came overnight, 31.78% against 3.65% during sessions. The fund dropped 10% or more from a 20-day high on 24 occasions, adding up to 98 days.
The fund's relation to its own 200-day line explains the result. It closed above the average on 65.06% of sessions and crossed it 59 times. That many crossings makes the average a noisy signal for this fund. The lag-one autocorrelation was -0.02. On the 27 sessions when RSI(14) closed under 30, the next 5 days had a median return of -0.17% against 0.22% for all days, and the next 20 days -0.78% against 0.77%. RSI(2) fell below 10 on 152 sessions, followed by medians of 0.74% and 1.8%. After deep RSI(14) readings the fund did worse than usual, yet the short-term RSI(2) readings were followed by better than usual returns, and the RSI(2) snapback template ranked second on this fund.
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.
How the rule interacts with this fund
Entry needs a close over the 200-day average and exit needs a close under it. There is no buffer, which the strategy page names as a source of churn. XLY gave it 59 crossings and the rule acted on 30 round trips of them, many lasting a day or two. The description states that price whips around the 200-day line during volatile bottoms, and this fund shows that: five trades closed in 2022 and seven more closed between February and May 2023.
Other trend templates did better on XLY, though none were strong. The EMA 12/26 trend made 2.36%, the golden cross 1.35% and the SMA 10/50 trend 0.35%. The mean reversion templates led, and the monthly cycle made 3.67% with a drawdown of 43.81%. On this fund the templates that bought dips or took profit targets finished ahead of the trend rules.
Within the six sector funds, XLY ranked last for this rule at -2.16%. SOXX made 19.21% with a drawdown of 39.17% and XLK 16.81% with 19.72%. VOX made 6.52%, XLF 2.06% and XLP -0.81%. The median across the sector funds was 6.52% and across all 59 funds 1.84%. XLY's figure sits under both.
The test stops at one window. Thirty trades are mostly small decisions, and the four long trades produced the large gains. A different start date, or a buffer around the line, would change which crossings turn into trades.
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 XLY?
Over 2021-01-04 to 2026-10-02, 200-day regime filter on XLY returned −2.2% annualized vs 6.3% for buy-and-hold: it trailed buy-and-hold by 8.4% per year, with a maximum drawdown 11.8 points shallower than holding (27.3% vs 39.1%).
How many trades did it make?
30 completed round trips over 5.7 years (60 fills), with 23% 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.
How did the 200-day regime filter do on XLY?
It turned $10,000 into $8,821 between 2021-01-04 and 2026-10-02, a CAGR of -2.16% with a maximum drawdown of 27.27%. Holding XLY made 6.27% a year with a 39.06% drawdown. The headline run has no fees or slippage.
Did the filter protect against the 2022 decline?
Partly. In 2022 the rule lost 18.6% against 35.7% for the fund, because it went to cash on 2022-04-06 and stayed there until 2023-02-01. January to April 2022 still cost it 9.19%, 4.85%, 3.26% and 2.6%.
Why is the win rate only 23%?
Seven of 30 closed trades won. XLY crossed its 200-day average 59 times, and many entries reversed within days. The median hold was 6 days and the median trade lost 1.41%.
How much do trading costs change the XLY result?
At 5 basis points the CAGR was -2.66% and at 10 basis points it was -3.13%, against -2.16% with no costs. The rule made 60 fills, and many of its trades were short.
Would a different average length work better?
The 100-day average made 1.66%, the 150-day made -0.5% and the 250-day made -3.45%. All three trail the 6.27% from holding. These are single-window results on one fund.
How many times did the rule trade?
30 round trips and 60 fills over 5.74 years. Eight closed in 2023 and 13 closed in 2026, the two busiest years.
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.