3-Month Momentum Switch on XLP
Consumer Staples Select Sector SPDR Fund: defensive consumer staples, a common risk-off equity sector. Backtest 2021-01-04 to 2026-10-02, $10,000 starting capital, computed by the same engine that runs live DeployQuant strategies.
The 3-month momentum switch lost money on XLP. Starting with $10,000 on 2021-01-04, it ended on 2026-10-02 at $9,078.76, a CAGR of -1.67%. Holding the Consumer Staples Select Sector SPDR Fund over the same window ended at $13,819.40, a CAGR of 5.8%. The gap to holding was 7.47 points a year. The rule also had the deeper drawdown, 23.63% against 15.99%, and a Sharpe ratio of -0.16 against 0.51.
The rule buys with 98% of the sleeve at the open when the trailing 63-day return is above +5%, and it sells everything at the open when that return falls below 0%. On a fund that trends, it holds the trend. XLP is a defensive sector fund that moved sideways for long stretches, and the rule took 13 round trips, won 3 of them, and lost 6 in a row at one point. The average winner was 5.0% and the average loser was -2.36%, giving a profit factor of 0.57.
It ranked 11th of the 12 templates on XLP. Other entry thresholds did not turn the result into a gain, and the test stops at one fund and one window of 5.74 years.
Year by year
| Year | 3-month momentum | buy & hold |
|---|---|---|
| 2021 | 3.5% | 18.1% |
| 2022 | −16.0% | −0.7% |
| 2023 | −4.5% | −0.9% |
| 2024 | 13.2% | 12.0% |
| 2025 | −2.3% | 1.5% |
| 2026 | −1.0% | 5.6% |
Year by year
The rule beat holding in one year out of six.
2021 returned 3.5% against 18.1% for buy-and-hold. The monthly table shows 0.0% for January, February and March, since the rule had no signal until 2021-04-16, when it entered at $60.24. It held that position for 168 days and sold on 2021-10-01 at $60.44, a gain of 0.33%. Over those months the fund rose far more than the rule captured: the 168-day trade earned almost nothing, and December 2021 gave the rule 3.15% from a second entry on 2021-12-14 at $65.88. The 2021 gap of 14.6 points is one of the two largest.
2022 returned -16.0% against -0.7%. This is the year that broke the result. XLP's own return was nearly flat, and the rule lost 16.0%. It made four trades that exited in 2022, and all four lost: -2.7% (2021-12-14 to 2022-03-11, 87 days), -4.69% (2022-04-20 to 2022-05-12, 22 days), -3.42% (2022-08-19 to 2022-08-30, 11 days) and -1.16% (2022-09-20 to 2022-09-23, 3 days). A fifth, from 2022-12-01 to 2023-02-17 at -4.91%, started in 2022 and ended in 2023. The monthly series for 2022 is negative in January, February, March, April, May, August, September and December.
The April entry deserves a note. The rule bought on 2022-04-20 at $70.75, the same date as XLP's peak before its 2022 decline, and sold on 2022-05-12 at $67.43. The 63-day return had crossed +5% just as the rally ended. That is the flip side of a three-month lookback: it confirms a trend after much of it has happened, so a late entry takes the reversal.
2023 returned -4.5% against -0.9%. The December 2022 entry lost 4.91% by 2023-02-17 and an entry on 2023-04-21 at $69.65 lost 2.53% by 2023-07-07. May 2023 was -6.01% for the rule. After July the rule was in cash until 2023-12-28, and the monthly table shows 0.0% from August to November.
2024 is the year the rule won, 13.2% against 12.0%. The trade that began 2023-12-28 at $66.66 held for 326 days and sold on 2024-11-18 at $75.96 for 13.95%, the best trade in the list. August 2024 gave 5.84%. October gave -3.43%, and the exit in November came a month later.
2025 returned -2.3% against 1.5%, with three round trips of 7, 30 and 6 days, all small losses: -1.52%, -0.79% and -0.1%. From August the rule was in cash for the rest of the year. 2026 to 2026-10-02 returned -1.0% against 5.6%.
Month by month
| Year | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2021 | 0.0% | 0.0% | 0.0% | −0.1% | 1.7% | −0.5% | 2.1% | 1.1% | −4.1% | 0.2% | 0.0% | 3.1% |
| 2022 | −1.4% | −1.3% | −3.0% | −2.7% | −1.9% | 0.0% | 0.0% | −3.3% | −1.1% | 0.0% | 0.0% | −2.4% |
| 2023 | −1.1% | −1.4% | 0.0% | 1.1% | −6.0% | 2.7% | −0.1% | 0.0% | 0.0% | 0.0% | 0.0% | 0.3% |
| 2024 | 1.2% | 2.0% | 3.2% | −1.0% | 2.3% | −0.2% | 1.6% | 5.8% | 1.2% | −3.4% | 0.0% | 0.0% |
| 2025 | 0.0% | −0.2% | −1.3% | 1.7% | −2.5% | 0.0% | −0.1% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% |
| 2026 | 2.6% | 7.6% | −8.2% | −0.6% | 0.0% | −2.1% | 2.3% | −0.1% | −1.8% | 0.0% | – | – |
Every trade
3-month momentum on XLP made 13 closed round trips, an average hold of 76 days, an average winner of 5.00%, an average loser of −2.36%, a profit factor of 0.57, a longest losing streak of 6. It held a position at the close on 46.9% of trading days.
| Entry | Entry price | Exit | Exit price | Return | Days held |
|---|---|---|---|---|---|
| 2021-04-16 | $60.24 | 2021-10-01 | $60.44 | 0.3% | 168 |
| 2021-12-14 | $65.88 | 2022-03-11 | $64.10 | −2.7% | 87 |
| 2022-04-20 | $70.75 | 2022-05-12 | $67.43 | −4.7% | 22 |
| 2022-08-19 | $68.73 | 2022-08-30 | $66.38 | −3.4% | 11 |
| 2022-09-20 | $63.71 | 2022-09-23 | $62.97 | −1.2% | 3 |
| 2022-12-01 | $69.21 | 2023-02-17 | $65.81 | −4.9% | 78 |
| 2023-04-21 | $69.65 | 2023-07-07 | $67.89 | −2.5% | 77 |
| 2023-12-28 | $66.66 | 2024-11-18 | $75.96 | 13.9% | 326 |
| 2025-02-26 | $79.46 | 2025-03-05 | $78.25 | −1.5% | 7 |
| 2025-04-14 | $77.18 | 2025-05-14 | $76.57 | −0.8% | 30 |
| 2025-07-11 | $78.12 | 2025-07-17 | $78.04 | −0.1% | 6 |
| 2026-01-14 | $79.80 | 2026-04-17 | $80.36 | 0.7% | 93 |
| 2026-06-29 | $84.32 | 2026-09-10 | $82.84 | −1.8% | 73 |
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.
Reading the 13 trades
Three of the 13 won. The list in order of entry date starts with a 0.33% gain and ends with a -1.76% loss. The median trade lost 1.52% and the median hold was 73 days. Holds ran from 3 days to 326 days, with an average of 75.5 days.
The losing streak of 6 runs from the 2021-12-14 entry to the 2023-07-07 exit, and a streak like that is normal for a rule with a 23% win rate. A rule that wins 3 of 13 needs its winners to be large, and here one winner was large. The 13.95% trade is far larger than the next best result of 0.7%. The other twelve trades lost on balance.
The 2026 trades show the same pattern at a smaller scale. The rule entered on 2026-01-14 at $79.8 and sold on 2026-04-17 at $80.36 for 0.7%. February 2026 gave 7.59%, the best month of the run, and March gave -8.23%, the worst. The round trip rode the gain and the loss, and the exit came after the drop. Buy-and-hold's drawdown from 2026-02-27 to 2026-03-20 was 9.52%, with no recovery in the data. The last trade ran from 2026-06-29 at $84.32 to 2026-09-10 at $82.84, down 1.76%.
Prices are adjusted for splits and dividends and sit below the quotes printed at the time.
The 2025 and 2026 whipsaws in detail
The rule's last three years show the pattern of short, wasted holds. On 2025-02-26 it bought at 79.46 and sold on 2025-03-05 at 78.25, a loss of 1.52% in 7 days. It bought again on 2025-04-14 at 77.18, ten days after the fund's 2025-04-04 loss of 4.24%, the second-worst day of the window. It sold on 2025-05-14 at 76.57. April 2025 returned 1.73% for the rule and May returned -2.46%, so the month of entry paid and the month of exit gave it back. The third 2025 trade, from 2025-07-11 to 2025-07-17, lost 0.1% over 6 days, the smallest loss in the list.
The fund's best day in the whole window was 2025-04-09 at 3.81%. The rule was in cash on that date, because its next entry came on 2025-04-14, after the 63-day return had recovered above +5%. It missed the best day and entered a few sessions later. The other best days were 2022-02-25 at 3.19%, 2026-07-16 at 2.8%, 2025-01-27 at 2.77% and 2022-06-21 at 2.69%. On 2026-07-16 the rule was in the position it bought on 2026-06-29, and July 2026 returned 2.32% to it.
The worst days were 2022-05-18 at -6.45%, 2025-04-04 at -4.24%, 2022-09-13 at -3.38%, 2022-03-08 at -2.75% and 2023-01-18 at -2.72%. The rule held through 2022-03-08 and 2023-01-18, so two of the five worst days of the fund landed on open positions. It was in cash for the other three, including the 2022-05-18 drop, which came six days after its exit. June 2026 lost 2.06% for the rule, August 2026 lost 0.08% and September lost 1.84%, the month it sold on 2026-09-10 at 82.84.
Largest drawdowns
| Peak | Low point | Depth | Days to low | Recovered | Days to recover |
|---|---|---|---|---|---|
| 2021-08-17 | 2023-05-30 | −23.6% | 651 | not yet | – |
| 2021-06-04 | 2021-06-18 | −3.7% | 14 | 2021-07-16 | 28 |
| 2021-05-10 | 2021-05-12 | −2.1% | 2 | 2021-05-24 | 12 |
Buy-and-hold's deepest drawdown ran from 2022-04-20 to 2022-10-07 and reached −16.0%.
Drawdown
The rule's largest drawdown was 23.63%, from a peak on 2021-08-17 to a low on 2023-05-30. That took 651 days to reach the low and had not recovered by 2026-10-02. The curve never got back to its August 2021 level. Buy-and-hold's largest drawdown was 15.99%, from 2022-04-20 to 2022-10-07, and it recovered by 2024-03-28.
The drawdown is long because the losses accumulated one trade at a time. There was no single fall of 24%. The fund's own worst day, -6.45% on 2022-05-18, came after the rule had already sold on 2022-05-12, and the rule's largest losses were each about 5% or smaller. A run of small losses made one large drawdown. The other two drawdowns in the table are small: 3.71% from 2021-06-04 to 2021-06-18, and 2.12% from 2021-05-10 to 2021-05-12. Both recovered within weeks.
A momentum switch is meant to avoid the long declines in a fund. XLP's decline of 16.27% from 2022-04-20 to 2022-10-07 was one the rule partly avoided: it was in cash for the lowest weeks. The rule's own drawdown nevertheless exceeded the fund's, because it had lost money on the way into and out of that decline.
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) | −1.7% | −23.6% | $9,079 | -0.16 |
| 5 basis points | −1.9% | −24.1% | $8,962 | -0.19 |
| 10 basis points | −2.1% | −24.5% | $8,852 | -0.22 |
Trading costs
The rule made 26 fills. At 5 basis points per fill the CAGR fell from -1.67% to -1.89%, the drawdown rose to 24.08% and the final value was $8,962.13. At 10 basis points the CAGR was -2.1%, the drawdown 24.49% and the final value $8,851.86. The Sharpe ratio moved from -0.16 to -0.19 and then -0.217.
The cost effect is small beside the shortfall to holding. XLP is a liquid fund, with an average daily dollar volume of $854,044,173 and a median minute volume of 17,592 shares, so fills of a size suited to a $10,000 account would be small relative to the market. The loss on this page comes from the rule, with costs a small addition.
Changing the parameters
| Version | CAGR | Max drawdown | Round trips | Win rate | Final value |
|---|---|---|---|---|---|
| Published rules | −1.7% | −23.6% | 13 | 23% | $9,079 |
| Enter above 0% | −3.0% | −27.4% | 50 | 38% | $8,396 |
| Enter above 10% | −0.4% | −14.5% | 5 | 20% | $9,756 |
| Enter above 15% | −1.1% | −9.4% | 1 | 0% | $9,395 |
Changing the entry threshold
The three variants changed the entry level, leaving the 0% exit as it was.
Enter above 0% removes the buffer, so the rule buys whenever the 63-day return turns positive. It made 50 trades and won 19, with a CAGR of -3.0%, a max drawdown of 27.44%, a Sharpe ratio of -0.248 and a final value of $8,396.46. It was the worst of the group. It shows what the 5% buffer in the published rules was for: without it the rule whipsawed.
Enter above 10% asks for a stronger run before buying. It made 5 trades and won 1, with a CAGR of -0.43%, a max drawdown of 14.53%, a Sharpe of -0.037 and a final value of $9,755.75. This was the best of the group on return and the drawdown was shallower than holding's 15.99%.
Enter above 15% made one trade, which lost, with a CAGR of -1.08%, a max drawdown of 9.43%, a Sharpe of -0.397 and a final value of $9,394.66.
None of the three finished above the $10,000 start. The higher thresholds cut the drawdown because they kept the rule out of the market, and the cost was return. With 1 to 5 trades the 10% and 15% rows describe very little. The 0% version shows that a lower bar makes the result worse, which supports the buffer in the published rules, but the pattern comes from one fund and one window.
How XLP behaved
| Measure | XLP |
|---|---|
| Data in this test | 2021-01-04 to 2026-10-02 (1444 sessions) |
| Total return, buy and hold | 40.3% |
| Annualized volatility | 13.3% |
| Deepest drawdown | −16.3% (2022-04-20 to 2022-10-07) |
| Up days | 51.6% |
| Average daily range | 1.12% |
| Average overnight gap | 0.29% |
| Correlation to SPY | 0.47 |
| Correlation to QQQ | 0.30 |
| Correlation to TLT | 0.13 |
| Sessions above the 200-day average | 75.1% |
| Crossings of the 200-day average | 73 |
| Falls of 10% or more from a 20-day high | 1 |
How XLP behaved
XLP is described as a defensive consumer staples fund, a common risk-off sector. It returned 40.33% over the window with a CAGR of 6.08% and an annualized volatility of 13.28%. It was up on 51.63% of sessions, with an average up day of 0.64% and an average down day of -0.63%.
The fund's correlation to SPY was 0.47 and to QQQ 0.3, with a beta of 0.38 to SPY. It tracked the broad market loosely. The funds closest to it were VTV at 0.64 and VOOV at 0.63. It crossed its 200-day average 73 times in the window and was above it on 75.1% of sessions. Frequent crossings of a long average mark a fund that kept reversing around its trend, which is the condition a momentum switch handles worst.
Most of the return came during the session. Intraday moves were 72.64% of the total and overnight moves 27.36%. The rule trades at the open and holds through the nights it is invested.
The fund's year-by-year pattern was uneven: 18.47% in 2021, -0.75% in 2022, -0.89% in 2023, 12.23% in 2024, 1.53% in 2025 and 5.68% in 2026 to date. Two flat years sat between two strong ones, and the rule was exposed to the flat ones without a trend to follow. Month-of-year averages come from 5 or 6 observations each. September averaged -3.79% and November 3.33%.
XLP had 1 fall of 10% or more from a 20-day high. After RSI(14) fell below 30, on 37 sessions, the median 20-day return was 2.44% against a baseline median of 0.73%. That is the profile of a fund where dips reversed, which suits rules that buy weakness and not a rule that waits for strength.
Seasonal averages, weekdays and RSI(2) on XLP
The fund's month-of-year averages, each from 5 or 6 observations, were 1.33% in January, 1.67% in February, 1.32% in March, 1.68% in April, -1.08% in May, -0.17% in June, 1.67% in July, 0.42% in August, 0.97% in October and 0.9% in December. September averaged -3.79% and November 3.33%. A rule that went to cash after losing 5% over three months has no way to use any of that. The rule's own September 2021 month was -4.07%, in line with the fund's weak September average.
By weekday the averages were 0.06% on Monday, -0.02% on Tuesday, -0.04% on Wednesday, 0.01% on Thursday and 0.13% on Friday. The lag-1 autocorrelation was -0.01, which means yesterday's return carried no information about today's. The average intraday range was 1.12%, wider than the 0.29% average overnight gap, so a decision made at the open has most of a day's movement still ahead of it.
The RSI(2) readings give the clearest picture of the fund. There were 156 sessions with RSI(2) below 10, and the median forward return was 0.26% over 5 days and 1.09% over 20 days, against baselines of 0.18% and 0.73%. Buying those short-term dips beat the baseline, and the RSI(2) snapback template is first on XLP for that reason. A trailing-return rule asks for the opposite condition. The beta to QQQ was 0.18 and to TLT 0.11, and the funds least correlated with XLP were SDS, SH and SPDN at -0.47, then VIXM at -0.33 and UVXY at -0.32.
The rules
Hold while the trailing 3-month return is positive (above +5% to enter, below 0% to exit).
- WHEN the market opens · IF not invested AND the 63-day return > +5% · THEN buy with 98% of the sleeve
- WHEN the market opens · IF invested AND the 63-day return < 0% · THEN sell the whole position
Time-series momentum on a quarterly lookback, the horizon much of the academic momentum literature uses. The template enters after a +5% three-month run and exits when the same measure turns negative. The gap between entry (+5%) and exit (0%) is a buffer against flip-flopping around a single threshold.
Good for: assets with long, persistent cycles, such as index, sector and managed-futures ETFs.
Watch out: a three-month lookback is slow; V-shaped crashes and recoveries can see it exit near the bottom and re-enter well off the low.
How 3-month momentum compares on XLP
On XLP the 3-month momentum switch ranked 11th of 12. The RSI(2) snapback led at 8.22% with a drawdown of 11.06%, followed by the RSI mean reversion at 6.51% with 9.64%, and the monthly cycle at 5.46% with 13.42%. The weekly 7% target returned 2.37%, the golden cross 2.05%, the trend plus trailing stop 1.82% and the dip buyer 1.32%. The SMA 10/50 trend returned 1.21% and the EMA 12/26 trend 1.19%. The 200-day regime filter returned -0.81%, and the momentum breakout came last at -1.87%.
The ordering follows the fund's character. The rules that buy weakness did best, and the trend and momentum rules did worst. The 3-month momentum switch was second to last on return, and its 23.63% drawdown sat close to the weekly target's 23.83% and the EMA 12/26's 22.82%, among the deepest on the fund.
Across all 59 funds this template had a median CAGR of 0%, and XLP ranked 40th of 59. Among the six sector funds the median was 6.06%. SOXX led at 14.3% and VOX returned 8.92%, then XLK at 6.06% and XLF at 2.74%. XLP at -1.67% was fifth and XLY was last at -3.94%. See the XLP fund page for all twelve templates.
Time in the market and the months
The rule held a position at the close on 46.9% of sessions, and the other sessions it sat in cash. Buy-and-hold was invested for all of them. A rule that is out of the market for more than half the time has to avoid larger losses than it misses gains, and on XLP it did the reverse. The fund earned its return across the months the rule was out, and the rule's entries came after a 63-day gain of more than 5%, which on a fund with a volatility of 13.28% is a gain that often reverses.
The monthly table shows how thin the return was inside the trades. The best months were February 2026 at 7.59%, August 2024 at 5.84% and March 2024 at 3.23%. The worst were March 2026 at -8.23%, May 2023 at -6.01% and September 2021 at -4.07%. Holding's worst month was also March 2026, at -8.31%, so the rule gave up almost nothing relative to the fund in that month and gained nothing from avoiding it. Holding's best month was December 2021 at 10.36%, and the rule made 3.15% in the same month.
The month-by-month record has long blocks of 0.0%. They run January to March 2021, June and July 2022, October and November 2022, August to November 2023 and August to December 2025. In each block the rule had exited and was waiting for a new 63-day gain above 5%. The waiting is where the strategy's shortfall to holding builds up, because the fund kept earning while the rule had no position.
What the test covers
This is one fund over one window of 5.74 years, with 13 trades. The result depends on how XLP moved in the two flat years, 2022 and 2023, and on the single 13.95% winner in 2024. A different start date would change the trade list. The headline run has no fees or slippage, and the cost runs add 5 and 10 basis points. Decisions are made at the open and fills are modeled on minute bars. Backtests are hypothetical and do not predict future results. Nothing on this page is investment advice.
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 3-month momentum beat buy-and-hold on XLP?
Over 2021-01-04 to 2026-10-02, 3-month momentum on XLP returned −1.7% annualized vs 5.8% for buy-and-hold: it trailed buy-and-hold by 7.5% per year, with a maximum drawdown of 23.6% (buy-and-hold: 16.0%).
How many trades did it make?
13 completed round trips over 5.7 years (26 fills), with 23% of round trips closing profitably.
Why 63 days?
63 trading days is about one quarter, a common momentum lookback. You can sweep it in DeployQuant to see how the horizon changes results.
Did 3-month momentum beat buy-and-hold on XLP?
No. It returned -1.67% a year against 5.8% for holding and ended at $9,078.76 against $13,819.40. It beat holding only in 2024, with 13.2% against 12.0%.
Why did the strategy lose so much in 2022?
It made four trades that exited in 2022 and all four lost, between -1.16% and -4.69%. XLP itself returned -0.75% that year, and the rule returned -16.0%. The April 2022 entry came on the same day as the fund's peak.
How many trades did it make and how many won?
It made 13 round trips and 26 fills. Three won, a win rate of 23%, and the longest losing streak was 6. The best trade returned 13.95% over 326 days.
How deep was the drawdown compared with holding XLP?
The rule's max drawdown was 23.63% and it had not recovered by 2026-10-02. Buy-and-hold's was 15.99% and recovered by 2024-03-28.
Does a higher entry threshold fix it on XLP?
Entering above 10% returned -0.43% with 5 trades, and above 15% returned -1.08% with 1 trade. Entering above 0% returned -3.0% with 50 trades. None of the three finished above the $10,000 start.
Which strategies worked better on XLP?
The [RSI(2) snapback](/learn/strategies/rsi2-dip-snapback/xlp/) returned 8.22% a year and the RSI mean reversion returned 6.51%. The 3-month momentum switch ranked 11th of 12.
Do trading costs matter for this strategy on XLP?
Little. At 5 basis points the CAGR was -1.89% and at 10 basis points -2.1%, against -1.67% in the headline run. The rule made 26 fills, and XLP is a liquid fund.
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.