200-Day SMA Regime Filter on XLF
Financial Select Sector SPDR Fund: S&P 500 banks, insurers and asset managers. Backtest 2021-01-04 to 2026-10-02, $10,000 starting capital, computed by the same engine that runs live DeployQuant strategies.
Only one question drives the 200-day regime filter: did the fund close above its 200-day simple average yesterday? If yes and the account is flat, it buys at the open with 98% of the sleeve. If no and the account is invested, it sells everything. XLF is the Financial Select Sector SPDR Fund, the S&P 500 banks, insurers and asset managers. From 2021-01-04 to 2026-10-02 a $10,000 account run this way ended at $11,243, a CAGR of 2.06% and a total return of 12.43%. Holding XLF ended at $19,742, a CAGR of 12.58%.
Of 19 closed trades, only 4 made money, a win rate of 21%. Winners averaged 9.42% and losers averaged -1.55%, so a few large gains covered many small losses and the profit factor came to 1.49. The longest losing streak was 7 trades. The account held XLF for 61.3% of days with an average hold of 61.7 days. A 20th position, bought on 2026-06-12 at an adjusted 52.58, was open at the end, up 1.71%.
Max drawdown was 22.03% against 25.47% for holding, and the Sharpe ratio was 0.23 against 0.76. By CAGR the rule ranks 12th of 12 strategies on XLF, the last place, and XLF ranks 29th of 59 funds for the rule. The numbers are hypothetical and come from 5.74 years of data with no fees in the headline run.
Year by year
| Year | 200-day regime filter | buy & hold |
|---|---|---|
| 2021 | −1.1% | 35.8% |
| 2022 | −9.6% | −10.4% |
| 2023 | 2.8% | 11.9% |
| 2024 | 29.9% | 29.9% |
| 2025 | −1.0% | 14.7% |
| 2026 | −4.9% | −1.1% |
How each year looked
The filter returned -1.1% in 2021, -9.6% in 2022, 2.8% in 2023, 29.9% in 2024, -1% in 2025 and -4.9% in 2026 to date. For a holder the figures were 35.8%, -10.4%, 11.9%, 29.9%, 14.7% and -1.1%. Gaps to holding ran -36.9 points in 2021, +0.8 in 2022, -9.1 in 2023, 0 in 2024, -15.7 in 2025 and -3.8 in 2026.
2021 is the largest single shortfall. XLF returned 35.8% and the rule had no position until 2021-10-19, so it collected October to December only. Nine zero months open the monthly table. The first buy was at 36.42 on 2021-10-19. The 200-day average needs 200 sessions of history before it exists, which fits a first signal about ten months in. That trade ran 129 days to 2022-02-25 at 35.21 and lost 3.32%. November 2021 lost 5.65% and December 2021 made 3.35%.
2022 is the only year where the rule led, by 0.8 points. It lost 9.6% against 10.4%, but the path was different. The first trade closed on 2022-02-25, and two short trades followed. A 2-day trade from 2022-02-28 at 35.3 to 2022-03-02 at 34.57 lost 2.07%, and a 19-day trade from 2022-03-17 to 2022-04-05 lost 0.06%. The account then sat in cash from May to October, when XLF fell to its low on 2022-10-12. It bought again on 2022-11-11 at 33.46 and sold on 2022-12-16 at 31.48 for -5.92%, the worst trade of the run. December 2022 cost 6.98%.
2023 trails by 9.1 points. The rule returned 2.8% while XLF returned 11.9%. It made six round trips that year and won two. January gained 6.69%, March lost 7.44%, and August to October lost 3.71%, 2.63% and 1.35%. The long trade from 2023-11-06 at 32.37, which would become the best of the window, began in November, and November and December 2023 added 5.63% and 5.39%.
2024 is a tie at 29.9% each. The filter held through the entire year from the November 2023 entry, so it matched the fund. 2025 is the second biggest shortfall, at -1% against 14.7%. The long trade ended on 2025-04-07 at 41.82, a day before XLF's April low, and the rule did not return until 2025-04-23 at 47.04. April 2025 cost the rule 15.49%, its worst month. 2026 is a partial year and both lines are slightly negative.
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% | 1.4% | −5.7% | 3.4% |
| 2022 | 0.0% | −1.6% | −1.7% | −1.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 1.5% | −7.0% |
| 2023 | 6.7% | −2.3% | −7.4% | 0.0% | 0.0% | −1.2% | 4.7% | −3.7% | −2.6% | −1.4% | 5.6% | 5.4% |
| 2024 | 2.9% | 4.0% | 4.8% | −4.0% | 3.1% | −0.9% | 6.3% | 4.4% | −0.5% | 2.6% | 10.2% | −5.4% |
| 2025 | 6.4% | 1.4% | −4.1% | −15.5% | 4.3% | 3.1% | 0.0% | 3.1% | 0.1% | −2.7% | 1.8% | 3.0% |
| 2026 | −2.4% | −3.9% | 0.0% | −0.1% | 0.0% | 1.3% | 6.1% | 1.3% | −7.0% | 0.2% | – | – |
Months in the market and months out
The monthly table opens with nine zeros, January to September 2021, and has more flat runs: May to October 2022, April and May 2023, and March and May 2026. Each zero is a month with no position.
November 2024 was the best month at 10.24%, followed by January 2023 at 6.69%, January 2025 at 6.38% and July 2026 at 6.07%. The rule's worst was April 2025 at -15.49%, then March 2023 at -7.44%, September 2026 at -7.05% and December 2022 at -6.98%. Holding had its best month in October 2022 at 11.62%, a month in which the rule was in cash, and its worst in June 2022 at -10.64%, also a cash month for the rule.
The April 2025 loss is worth a closer look. The rule held XLF from 2023-11-06. It sold on 2025-04-07 at 41.82 after the fund had already dropped below its 200-day line. The sell came after the decline had done its damage, so April carried the loss, and the rebound that followed was missed until the re-entry on 2025-04-23. The rule was out of the fund on 2025-04-09, when XLF rose 7.59%.
Months such as May 2025 (4.35%), June 2025 (3.12%) and December 2025 (3.02%) were small gains. The rule's gains and losses are both inside a narrow band for most months. It takes an unusual month, either November 2024 or April 2025, to move the account by more than 10%.
Every trade
200-day regime filter on XLF made 19 closed round trips and one position still open at the end of the test, an average hold of 62 days, an average winner of 9.42%, an average loser of −1.55%, a profit factor of 1.49, a longest losing streak of 7. It held a position at the close on 61.3% of trading days.
| Entry | Entry price | Exit | Exit price | Return | Days held |
|---|---|---|---|---|---|
| 2021-10-19 | $36.42 | 2022-02-25 | $35.21 | −3.3% | 129 |
| 2022-02-28 | $35.30 | 2022-03-02 | $34.57 | −2.1% | 2 |
| 2022-03-17 | $35.12 | 2022-04-05 | $35.10 | −0.1% | 19 |
| 2022-11-11 | $33.46 | 2022-12-16 | $31.48 | −5.9% | 35 |
| 2022-12-22 | $31.88 | 2022-12-23 | $31.76 | −0.4% | 1 |
| 2022-12-27 | $32.02 | 2023-03-10 | $31.06 | −3.0% | 73 |
| 2023-06-16 | $31.90 | 2023-06-21 | $31.46 | −1.4% | 5 |
| 2023-06-30 | $31.98 | 2023-08-23 | $32.03 | 0.2% | 54 |
| 2023-08-24 | $32.31 | 2023-08-25 | $32.32 | 0.0% | 1 |
| 2023-08-28 | $32.42 | 2023-09-27 | $31.81 | −1.9% | 30 |
| 2023-10-18 | $32.05 | 2023-10-19 | $31.61 | −1.4% | 1 |
| 2023-11-06 | $32.37 | 2025-04-07 | $41.82 | 29.2% | 518 |
| 2025-04-10 | $45.53 | 2025-04-11 | $44.81 | −1.6% | 1 |
| 2025-04-15 | $46.41 | 2025-04-17 | $45.72 | −1.5% | 2 |
| 2025-04-23 | $47.04 | 2026-02-13 | $50.94 | 8.3% | 296 |
| 2026-02-19 | $51.55 | 2026-02-20 | $51.32 | −0.5% | 1 |
| 2026-04-20 | $52.14 | 2026-04-22 | $52.09 | −0.1% | 2 |
| 2026-06-08 | $51.87 | 2026-06-09 | $51.81 | −0.1% | 1 |
| 2026-06-10 | $51.98 | 2026-06-11 | $51.92 | −0.1% | 1 |
| 2026-06-12 | $52.58 | open | – | 1.7% | – |
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
There were 19 closed round trips and 1 open at the end. Prices shown are split and dividend adjusted and sit below the quotes of the day. The five largest returns:
- 2023-11-06 at 32.37 to 2025-04-07 at 41.82: 29.19% in 518 days.
- 2025-04-23 at 47.04 to 2026-02-13 at 50.94: 8.29% in 296 days.
- 2023-06-30 at 31.98 to 2023-08-23 at 32.03: 0.16% in 54 days.
- 2023-08-24 at 32.31 to 2023-08-25 at 32.32: 0.03% in 1 day.
- 2022-03-17 at 35.12 to 2022-04-05 at 35.1: -0.06% in 19 days.
The five worst:
- 2022-11-11 at 33.46 to 2022-12-16 at 31.48: -5.92% in 35 days.
- 2021-10-19 at 36.42 to 2022-02-25 at 35.21: -3.32% in 129 days.
- 2022-12-27 at 32.02 to 2023-03-10 at 31.06: -3% in 73 days.
- 2022-02-28 at 35.3 to 2022-03-02 at 34.57: -2.07% in 2 days.
- 2023-08-28 at 32.42 to 2023-09-27 at 31.81: -1.88% in 30 days.
The median trade lost 0.45% and the median hold was just 2 days. The longest hold was 518 days and the shortest was 1. The first trade lost 3.32% and the open trade was up 1.71% at the end. Wins never came more than 2 in a row, and losses ran as long as 7.
Two trades made the result. Both lasted most of a year or longer, and the larger one, 29.19% over 518 days, is the main reason the account finished positive at all. Everything else in the list is within a few percent either way. The median hold of 2 days says that most trades were whipsaws: the price crossed the 200-day line, the rule bought or sold, and the price crossed back within days. The trades entered on 2023-08-24 and 2023-08-28 belong to one such cluster, and the first of them lasted 1 day and earned 0.03%.
Counting by the year of exit, the rule won none of 5 trades in 2022, two of 6 in 2023, one of 3 in 2025 and one of 5 in 2026. No trade closed in 2021 or 2024, since a single position was open through all of 2024.
Largest drawdowns
| Peak | Low point | Depth | Days to low | Recovered | Days to recover |
|---|---|---|---|---|---|
| 2022-01-12 | 2023-11-09 | −22.0% | 666 | 2024-07-15 | 249 |
| 2025-02-18 | 2025-04-23 | −20.6% | 64 | not yet | – |
| 2021-10-22 | 2021-12-01 | −7.4% | 40 | 2022-01-04 | 34 |
Buy-and-hold's deepest drawdown ran from 2022-01-12 to 2022-10-12 and reached −25.5%.
The drawdowns
The deepest drawdown was 22.03%, from the peak on 2022-01-12 to a trough on 2023-11-09, 666 days later, with recovery on 2024-07-15 after 249 days. Second came a 20.64% slide from 2025-02-18 to 2025-04-23 that had not healed by the data's last day, and third a 7.36% dip from 2021-10-22 to 2021-12-01, repaired on 2022-01-04.
A holder's worst drawdown was 25.47%, running 2022-01-12 to 2022-10-12 and healing on 2024-02-22 after 498 days. Two shallower ones followed: 15.33% in early 2025, healed 2025-06-27, and 14.65% in early 2026, healed 2026-07-06.
The rule's maximum was 3.44 points shallower than holding's. That is a small saving for a large cost in return. The rule was also worse than holding in the 2025 episode, a 20.64% drawdown against 15.33%. The reason is the timing: the rule did not sell until 2025-04-07, close to the low, and it bought back at a higher price on 2025-04-23. The account's drawdown was still open on the final day, while the holder's had recovered by 2025-06-27.
The 2022 to 2023 episode tells the opposite story. The rule's peak was the same date as XLF's, and its drawdown ran 666 days, longer than XLF's own 273 days to its trough, because the repeated small losses of late 2022 and early 2023 added to the 2022 decline. The account recovered on 2024-07-15, after the fund's own recovery on 2024-02-22.
The Sharpe ratio of 0.23 against 0.76 for holding shows that the filter reduced risk less than it reduced return.
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.1% | −22.0% | $11,243 | 0.23 |
| 5 basis points | 1.7% | −22.9% | $11,029 | 0.20 |
| 10 basis points | 1.4% | −23.7% | $10,815 | 0.17 |
What trading costs did
Fees are zero in the headline run. Charging 5 basis points per fill gave a CAGR of 1.72%, a 22.86% drawdown and $11,029. Charging 10 gave 1.37%, 23.71% and $10,815. The Sharpe ratio slid from 0.23 to 0.202 and then 0.174.
The rule made 39 fills, many of them in whipsaw clusters where each round trip earns close to nothing. Those trades pay the cost in full and earn almost nothing. Liquidity is no obstacle for a $10,000 account, given daily dollar volume of $1,682,204,673 and a median of 62,901 shares per minute. The cost question is about the number of signals, not the size of orders.
Changing the parameters
| Version | CAGR | Max drawdown | Round trips | Win rate | Final value |
|---|---|---|---|---|---|
| Published rules | 2.1% | −22.0% | 19 | 21% | $11,243 |
| 100-day SMA | 2.0% | −18.4% | 35 | 34% | $11,204 |
| 150-day SMA | 4.6% | −21.8% | 23 | 30% | $12,945 |
| 250-day SMA | 0.4% | −26.9% | 21 | 14% | $10,248 |
What changing the window did
The averaging window was the only thing changed in three variants.
- 100-day SMA: CAGR 2%, max drawdown 18.42%, end equity $11,204, with 35 trades and 12 wins.
- 150-day SMA: CAGR 4.6%, max drawdown 21.82%, end equity $12,945, with 23 trades and 7 wins.
- 250-day SMA: CAGR 0.43%, max drawdown 26.87%, end equity $10,248, with 21 trades and 3 wins.
The base 200-day rule returned 2.06% with 19 trades and 4 wins. A 100-day average made 35 trades, the most of the four, and returned about the same, 2%, with the shallowest drawdown at 18.42%. A 150-day average did best at 4.6%, with a Sharpe ratio of 0.428. A 250-day average did worst, at 0.43%, with the deepest drawdown at 26.87%, which is deeper than holding's 25.47%.
None of the four came close to holding at 12.58%. The ordering is not smooth: 100, 200 and 250 days sit within a few points of each other while 150 days stands apart. With 19 to 35 trades in a window containing one major bear market, the best setting here is the product of timing luck as much as anything else. The common thread is that every variant lagged holding by a wide margin.
How XLF behaved
| Measure | XLF |
|---|---|
| Data in this test | 2021-01-04 to 2026-10-02 (1444 sessions) |
| Total return, buy and hold | 102.9% |
| Annualized volatility | 18.4% |
| Deepest drawdown | −25.9% (2022-01-12 to 2022-10-12) |
| Up days | 52.9% |
| Average daily range | 1.40% |
| Average overnight gap | 0.49% |
| Correlation to SPY | 0.77 |
| Correlation to QQQ | 0.59 |
| Correlation to TLT | -0.05 |
| Sessions above the 200-day average | 71.2% |
| Crossings of the 200-day average | 38 |
| Falls of 10% or more from a 20-day high | 10 |
How XLF behaved
The fund itself roughly doubled, up 102.88% for a CAGR of 13.11%, at annualized volatility of 18.43%. Year by year it made 36.61% (2021), lost 10.55% (2022), then made 12.11%, 30.43% and 14.86%, and stood at -1.15% in the partial year 2026. The worst fall started 2022-01-12, bottomed on 2022-10-12 at 25.87% and was repaired by 2024-02-22. The longest spell under water ran 528 sessions.
Price finished above the 200-day average on 71.16% of sessions. For this rule that is the key figure, since most of the window the filter said to own the fund, and the fund went up. The price crossed the average 38 times, and each crossing is a potential trade. The two long trades are the cases where a crossing led to a lasting move.
Of all sessions, 52.88% were up days, and up and down days both averaged 0.86% in size. The strongest day was 2025-04-09 at +7.59%, and the weakest was 2025-04-04 at -7.36%. Against SPY the beta was 0.87 and the correlation 0.77. Overnight moves accounted for 62.56% of the return and the intraday session for 37.44%.
On the 30 sessions when RSI(14) dropped under 30, the next 5 days had a median of 0.75% and the next 20 days a median of 3.18%, where an average session gave 0.42% and 1.5%. Oversold readings on XLF were followed by better-than-usual returns, which fits the RSI mean reversion rule coming first on this fund. A drop of 10% or more from the 20-day high happened in 10 events over 45 days. Sharp drops were brief, and a rule that waits for the price to close under a 200-day line reacts after much of a drop has happened.
How XLF compares with other sector funds
Among the six sector funds, XLF's 2.06% ranks fourth. SOXX returned 19.21% with a drawdown of 39.17%, XLK returned 16.81% with a drawdown of 19.72% and 11 round trips, and VOX returned 6.52%. Behind XLF were XLP at -0.81% with 37 round trips and XLY at -2.16% with 30. The sector median was 6.52% and the median over all 59 funds was 1.84%. XLK and SOXX gave the filter its best results, and XLK needed just 11 round trips to get there.
On XLF the filter sits last of 12 strategies. RSI mean reversion made 11.82% and the monthly cycle 11.63%, followed by the RSI(2) snapback at 9.72% with the shallowest drawdown, 14.57%. The weekly 7% target made 7.13%, the momentum breakout 6.99% and the dip buyer 6.78%. The EMA 12/26 trend returned 5.63%, the SMA 10/50 trend 4.02%, the golden cross 3.6%, 3-month momentum 2.74% and the trend with a trailing stop 2.62%. The monthly cycle, which is invested nearly all the time, beat the filter by a wide margin, a plain way of seeing how much return the filter's cash periods gave up.
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 single-line rule met this fund
The strategy page says price can whip across the 200-day line near a volatile bottom and produce clusters of buy-sell pairs. The XLF record fits that: a median hold of 2 days, a win rate of 21% and a seven-trade losing streak. It also shows the upside of the same design. The one long trade of 518 days earned 29.19% and the second long trade earned 8.29%.
The filter protected against the first leg of 2022 and gave back much of that protection through re-entries. Scope: one fund, 5.74 years, a fixed 200-day average with no buffer band, no fees in the headline run. Other funds and periods can look different, and none of this is a forecast.
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 XLF?
Over 2021-01-04 to 2026-10-02, 200-day regime filter on XLF returned 2.1% annualized vs 12.6% for buy-and-hold: it trailed buy-and-hold by 10.5% per year, with a maximum drawdown 3.4 points shallower than holding (22.0% vs 25.5%).
How many trades did it make?
19 completed round trips over 5.7 years (39 fills), with 21% 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 earn on XLF?
The account grew from $10,000 to $11,243 between 2021-01-04 and 2026-10-02. CAGR was 2.06% and max drawdown 22.03%. Of 19 closed trades 4 won, and a 20th was still open.
Did the filter beat buy-and-hold on XLF?
No. A holder finished at $19,742 with a CAGR of 12.58%. The filter led only in 2022, by 0.8 points, and tied in 2024 at 29.9%. Its largest shortfall was 2021, at -36.9 points.
Why is the win rate only 21%?
Many of the 19 trades were short whipsaws near the 200-day line, and the median hold was 2 days. Four trades won, with an average gain of 9.42%, and the losers averaged -1.55%. The profit factor was 1.49.
What happened in April 2025?
The rule sold on 2025-04-07 at 41.82 and did not buy again until 2025-04-23 at 47.04. April 2025 was its worst month at -15.49%, and it missed the rebound in between.
Does a 150-day or 100-day average work better on XLF?
A 150-day average returned 4.6% with a Sharpe ratio of 0.428, and a 100-day average returned 2% with a drawdown of 18.42%. A 250-day average returned 0.43%. None of them came near holding.
How much do trading costs matter?
The CAGR came to 1.72% with 5 basis points and 1.37% with 10, versus 2.06% at zero cost. The rule made 39 fills, and many were whipsaw trades that earned close to nothing.
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.