XLP trading strategies, backtested
Consumer Staples Select Sector SPDR Fund: defensive consumer staples, a common risk-off equity sector. Every DeployQuant template run on XLP over 5.7 years of minute data, same engine, same window, sorted by return.
XLP holds US consumer staples, the defensive end of the equity market. Buy-and-hold over 2021-01-04 to 2026-10-02 made 5.80% a year, turned $10,000 into $13,819 and had a max drawdown of 15.99%. Its annualized volatility was 13.28% and its beta to SPY was 0.38.
Twelve templates ran on XLP under identical conditions. Two beat the fund on CAGR: the RSI(2) snapback at 8.22% and the RSI(14) mean reversion at 6.51%. Seven had a shallower drawdown than holding, and nine finished with a positive CAGR. The trend and breakout templates all landed between -1.87% and 2.05%.
This page is the opposite case to a high-beta fund. XLP rarely falls 10% from a 20-day high, so rules that wait for a big move have little to do. It also does not trend for long, so rules that wait for trend confirmation pay for it. The result is that the two mean-reversion templates with RSI triggers lead and almost everything else trails buy-and-hold.
The headline run has no fees or slippage. The cost runs at 5 and 10 basis points matter a good deal for the short-hold templates, and they are covered below with the trading table.
| Strategy | CAGR | max DD | Sharpe | trades | win rate | final value |
|---|---|---|---|---|---|---|
| RSI(2) Dip Snapback | 8.2% | −11.1% | 0.96 | 166 | 64% (+1 open) | $15,740 |
| RSI(14) Mean Reversion | 6.5% | −9.6% | 0.75 | 16 | 81% | $14,360 |
| First-to-Last Day of Month | 5.5% | −13.4% | 0.50 | 69 | 54% (+1 open) | $13,570 |
| Weekly Entry + 7% Target | 2.4% | −23.8% | 0.27 | 85 | 19% | $11,436 |
| Golden Cross (SMA 50/200) | 2.0% | −14.3% | 0.24 | 3 | 67% (+1 open) | $11,236 |
| SMA-200 Trend + 15% Trailing Stop | 1.8% | −22.0% | 0.21 | 2 | 0% (+1 open) | $11,092 |
| Drawdown Dip Buyer + 8% Target | 1.3% | −8.0% | 0.44 | 1 | 100% | $10,780 |
| SMA 10/50 Trend | 1.2% | −15.6% | 0.17 | 19 | 37% | $10,714 |
| EMA 12/26 Trend | 1.2% | −22.8% | 0.17 | 27 | 48% | $10,701 |
| 200-Day SMA Regime Filter | −0.8% | −21.4% | -0.03 | 37 | 30% | $9,545 |
| 3-Month Momentum Switch | −1.7% | −23.6% | -0.16 | 13 | 23% | $9,079 |
| 20-Day Momentum + Trailing Stop | −1.9% | −14.5% | -0.36 | 2 | 0% | $8,975 |
| Buy & hold XLP | 5.8% | −16.0% | 0.51 | – | – | $13,819 |
Which templates fit a low-volatility fund
RSI(2) snapback made 8.22% with 166 round trips, a 64% win rate and a max drawdown of 11.06%, against 15.99% for the fund. The Sharpe ratio was 0.96 against 0.51. The average win was 1.04% and the average loss was -1.05%, so the edge is the win rate and not the size of the winners. The profit factor was 1.75. It was invested on 41.5% of days with an average hold of 5.4 days.
The yearly profile is lopsided. It made 10.2% in 2021, 9.1% in 2022, 2.9% in 2023, 3.3% in 2024, lost 1.6% in 2025, and made 25.2% in 2026 to date. In 2022 and 2023, when XLP returned -0.7% and -0.9% held, it beat the fund by a clear margin. In 2021 and 2024, when the fund returned 18.1% and 12.0%, it trailed because it was only partly invested. Its best month was July 2026 at 9.83%.
RSI(14) mean reversion made 6.51% with only 16 round trips, 13 of them winners, for an 81% win rate. The profit factor was 8.55, the highest in the whole table for this fund, and its max drawdown of 9.64% was the shallowest of the top five. Its average win was 3.29% and its average loss was -1.58%. The best trade ran from 2021-12-02 to 2021-12-17 for 8.44% at adjusted prices of 61.70 and 66.91. The worst, -3.22%, was an entry on 2023-08-18 held for 90 days. Its worst month was September 2022 at -7.41%, which is also the month of the fund's autumn 2022 low.
The monthly cycle made 5.46% with 95.2% exposure and 69 round trips, a little below the fund's 5.80%. It finished at $13,570 against $13,819. It tracks holding closely because it is invested nearly all the time and misses only the turn-of-month days.
The weekly 7% target made 2.37% and is the first of the rules that struggle here. It won only 19% of 85 round trips and the longest losing streak was 12. A 7% move in a week is rare for a fund with 13.28% annual volatility, so most positions were closed by the Thursday rule or sat unfilled for a long time: the longest hold was 185 days and the average was 20.4. Its max drawdown of 23.83% is deeper than the fund's.
The dip buyer made one trade. It bought on 2022-05-19 at an adjusted 62.85 and sold on 2022-08-15 at 67.88 for 8.00%. The profile table shows why there was only one: XLP had a single fall of 10% or more from a 20-day high in the window, and it lasted 3 sessions. That one trade left the strategy at 1.32% CAGR and 4.1% exposure. The worst single day in the data, -6.45% on 2022-05-18, is the day before the entry.
The trend rules came out between about -2% and 2%. The golden cross made 2.05% from 3 round trips, 2 of them winners, and spent 67.0% of days invested. One trade held 625 days from 2024-02-06 and returned 13.28%, which is most of its result. The trend plus trailing stop made 1.82% from 2 closed trades, both losses, and an open position carrying a gain of 20.67% from 2023-12-14. The EMA 12/26 and SMA 10/50 templates made 1.19% and 1.21% with 27 and 19 round trips. The 200-day regime filter lost 0.81% with 37 round trips and a 30% win rate, and the 3-month momentum switch lost 1.67% with a 23% win rate. The momentum breakout lost 1.87% in two trades.
The 200-day average was crossed 73 times in the window, even though the fund stayed above it on 75.10% of sessions. A fund that hovers around its long average gives a regime filter many false signals, and the 37 round trips with a profit factor of 0.82 show that directly.
How each strategy traded XLP
| Strategy | Time in market | Avg hold (days) | Best trade | Worst trade | Profit factor | With 10 bps slippage |
|---|---|---|---|---|---|---|
| RSI(2) snapback | 41.5% | 5 | 4.0% | −5.2% | 1.75 | 2.3% |
| RSI mean reversion | 41.7% | 54 | 8.4% | −3.2% | 8.55 | 5.9% |
| monthly cycle | 95.2% | 28 | 8.9% | −8.0% | 1.35 | 3.0% |
| weekly 7% target | 87.1% | 20 | 7.0% | −8.1% | 1.15 | −0.1% |
| golden cross | 67.0% | 389 | 13.3% | −3.7% | 5.00 | 1.9% |
| trend + trailing stop | 81.9% | 348 | −0.4% | −7.5% | – | 1.8% |
| dip buyer | 4.1% | 88 | 8.0% | 8.0% | – | 1.3% |
| SMA 10/50 trend | 59.9% | 67 | 9.9% | −6.8% | 1.24 | 0.5% |
| EMA 12/26 trend | 61.2% | 48 | 9.2% | −4.0% | 1.19 | 0.3% |
| 200-day regime filter | 64.8% | 37 | 12.0% | −4.3% | 0.82 | −2.1% |
| 3-month momentum | 46.9% | 76 | 13.9% | −4.9% | 0.57 | −2.1% |
| momentum breakout | 8.8% | 92 | −4.5% | −6.2% | – | −1.9% |
What the cost runs do to the leaders
The two leaders react very differently to slippage. RSI(2) snapback has 333 fills and falls from 8.22% to 5.21% at 5 basis points and to 2.26% at 10. At 10 basis points it finishes at $11,369, well below the $13,819 from holding, and the max drawdown rises to 15.82%. Its per-trade edge is 1.04% on the average win, so a few basis points on each of two fills per trade is a large share of the profit. At 5 basis points it is still ahead of the fund's drawdown but behind its CAGR.
RSI(14) mean reversion has 32 fills and falls only from 6.51% to 6.21% and then 5.93%. At 10 basis points it finishes at $13,917, above the fund's $13,819, with a max drawdown of 9.87%. It is the one template that beats buy-and-hold at every cost level in the table. With 16 round trips, the sample is small, and the margin over holding at 10 basis points is narrow, so the claim is limited to this window.
The weekly template drops from 2.37% to 1.01% at 5 basis points and to -0.11% at 10, with a max drawdown of 28.74%. It ends the high-cost run at $9,937, a loss. The monthly cycle goes from 5.46% to 4.25% and 3.00%. The golden cross, with 7 fills, goes from 2.05% to 1.98% and 1.92%. The dip buyer is unchanged at 1.32%.
Time in market splits the table in two. RSI(2), RSI(14) and the dip buyer are invested on 41.5%, 41.7% and 4.1% of days. The weekly and monthly templates are invested on 87.1% and 95.2%, and the trend rules between 59.9% and 81.9%. The trend plus trailing stop is invested on 81.9% of days for a CAGR of 1.82%, while RSI(14) earns 6.51% with half of that exposure. On a fund with 13.28% volatility, time in the market earned little in this window, and being selective about entry earned more.
Hold times follow the same split. RSI(2) holds for 5.4 days and RSI(14) for 54.1. The golden cross averaged 388.7 days. The momentum breakout held 91.5 days on two losing trades at -4.53% and -6.24%, and both exits came after a fall started. XLP's best months were December 2021 at 10.36% and its worst was March 2026 at -8.31%, and the trend rules that held through March 2026 still show the open drawdown from 2026-02-27 in their tables.
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 |
Calendar years
| Year | Return |
|---|---|
| 2021 | 18.5% |
| 2022 | −0.8% |
| 2023 | −0.9% |
| 2024 | 12.2% |
| 2025 | 1.5% |
| 2026 (part) | 5.7% |
Biggest single days
| Best day | Move |
|---|---|
| 2025-04-09 | 3.8% |
| 2022-02-25 | 3.2% |
| 2026-07-16 | 2.8% |
| 2025-01-27 | 2.8% |
| 2022-06-21 | 2.7% |
| Worst day | Move |
|---|---|
| 2022-05-18 | −6.5% |
| 2025-04-04 | −4.2% |
| 2022-09-13 | −3.4% |
| 2022-03-08 | −2.8% |
| 2023-01-18 | −2.7% |
Average return by calendar month
| Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1.3% | 1.7% | 1.3% | 1.7% | −1.1% | −0.2% | 1.7% | 0.4% | −3.8% | 1.0% | 3.3% | 0.9% |
Most and least correlated funds
| Most correlated | Least correlated | ||
|---|---|---|---|
| VTV | 0.64 | SDS | -0.47 |
| VOOV | 0.63 | SH | -0.47 |
| XLF | 0.48 | SPDN | -0.47 |
| FAS | 0.48 | VIXM | -0.33 |
| SSO | 0.47 | UVXY | -0.32 |
How XLP behaved over the window
XLP returned 40.33% in total over 1444 sessions, which is 6.08% a year on the price series. Calendar returns were 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 sit between two strong ones. That shape is hard for trend rules: they enter during the 2021 run, sit through two flat years and exit near the lows.
The deepest drawdown was 16.27% from 2022-04-20 to 2022-10-07, and the fund did not recover until 2024-03-28. The longest drawdown lasted 486 sessions. A decline of that depth is modest next to broad index funds, and the recovery took long because the fund spent 2023 going nowhere. Most templates here have a max drawdown inside 10% to 25%, so the choice of template changed the drawdown by only a few points either way. The shallowest was the dip buyer at 8.03% and the deepest was the weekly template at 23.83%.
The daily statistics are mild. Up days were 51.63% of sessions. The average up day was 0.64% and the average down day was -0.63%. The average daily range was 1.12% and the average overnight gap was 0.29%. The lag-1 autocorrelation was -0.01, so the fund has no persistent daily direction. The overnight share of return was 27.36% and the intraday share was 72.64%, which is the reverse of IWM and most growth funds. XLP earned more inside the trading day than between the close and the open.
The best days were 3.81% on 2025-04-09 and 3.19% on 2022-02-25. The worst were -6.45% on 2022-05-18 and -4.24% on 2025-04-04. The May 2022 drop sits inside the main drawdown, and the April 2025 drop sits inside a shallower one.
RSI statistics explain the leaderboard. After an RSI(14) reading under 30, which happened on 37 sessions, the median 20-day forward return was 2.44%, against a baseline of 0.73% for all sessions. After an RSI(2) reading under 10, which happened on 156 sessions, the median 5-day forward return was 0.26% against a baseline of 0.18%, and the 20-day return was 1.09%. Both signals had a positive edge here, and the slower RSI(14) signal had the larger one, which is consistent with RSI(14) mean reversion having the 81% win rate and the higher profit factor. The edge for RSI(2) is small per signal, which is why its result is so sensitive to costs.
The fund was above its 200-day average on 75.10% of sessions and crossed it 73 times. Seasonal averages are thin with 5 or 6 observations per month, and the table shows September at -3.79% and November at 3.33%, which should be read as a description of six Septembers.
XLP's correlation to SPY was 0.47, to QQQ 0.30 and to TLT 0.13. The funds closest to it were VTV at 0.64 and VOOV at 0.63, both value funds, and the least correlated were inverse funds like SH at -0.47. Among sector funds, XLK held at 22.07% and XLF at 12.58%, so XLP at 5.80% was the laggard of the group in raw return and the calmest in volatility. On XLF the best template was the RSI mean reversion, as here. On XLY and XLK the best were weekly and monthly templates. A defensive, range-bound fund favoured the slower RSI trigger, and the volatile ones favoured the calendar templates.
The limits of the test are the same as for every page here. It is one window of 5.74 years with a handful of trades for the slow templates, no fees in the headline run, and daily-decision rules only.
Calendar months, the intraday return share and extreme sessions
The month-of-year averages show where the fund's gains and losses sat. September averaged negative 3.79%, the weakest month by a wide margin, and November averaged 3.33%. February, April and July each averaged about 1.67%, and May averaged negative 1.08%. Each month occurs five or six times in the window, so the September figure may rest on one or two bad years. The month table above shows the single best month, 2021-12 at 10.36%, and the single worst, 2026-03 at negative 8.31%. A fund with 13.28% annualized volatility can still post a month that large, and a strategy holding cash through it avoids the loss as well as any later gain.
The day-of-week averages are small. Friday was the highest at 0.13% and Wednesday the lowest at negative 0.04%. The lag-1 autocorrelation was negative 0.01. Neither gives a daily rule much to use on this fund.
XLP earned most of its return during the trading session. The overnight share of the log return was 27.36% and the intraday share was 72.64%. Compare that with XLK, where the overnight share was the larger one. The templates here decide at the close and trade at the next open or later, so a fund that earns more inside the session loses less from the delay between signal and fill than one that earns its gains in the gap. The average overnight gap on XLP was 0.29% and the average intraday range was 1.12%.
The largest single-day moves in the window were modest for an equity fund. The best day was 2025-04-09 at 3.81%, and the worst was 2022-05-18 at negative 6.45%. That worst day stands apart: the next worst was 2025-04-04 at negative 4.24%. The 2022-05-18 move is the kind of single-session loss a stop would have cut, and a rule with no stop took in full. Only one 20-day drop of 10% occurred in the window, covering 3 days. Rules built to dodge large declines had almost no large declines to dodge.
The 200-day average did little to separate good periods from bad ones. The fund closed above it on 75.1% of sessions, yet crossed it 73 times, many more than XLK's 22 crossings. A trend filter on XLP therefore flipped in and out often, and each flip cost a round trip. That is consistent with the weak showing of the slower trend templates in the ranking. Mean reversion fit better, and the RSI(2) snapback at 8.22% and the RSI(14) version at 6.51% both finished above holding. After the RSI(14) fell below 30, which happened on 37 sessions, the median 20-day forward return was 2.44%, against a baseline of 0.73% for all sessions. The 5-day figure was 0.59% against 0.18%. These are medians over a small set of overlapping windows, so they show a lean in this sample and nothing firmer.
XLP moved with the broad market only partly. Its correlation to SPY was 0.47 and its beta 0.38. The funds it tracked most closely were value funds, VTV at 0.64 and VOOV at 0.63, and the inverse S&P funds SDS, SH and SPDN sat at negative 0.47. Among the other sector funds in the test, XLY held at 6.27% against 5.8% here, and its best rule, the weekly 7% target, made 10.19%. XLF held at 12.58%.
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
What was the best strategy for XLP?
Of the 12 templates tested on XLP over 2021-01-04 to 2026-10-02, the strongest by CAGR was RSI(2) snapback at 8.2% (max drawdown 11.1%), versus 5.8% for buy-and-hold. The best result in hindsight is not a forecast. Check drawdowns and trade counts before drawing conclusions.
Did any strategy beat buying and holding XLP?
2 of 12 templates beat XLP buy-and-hold (5.8% CAGR) on this window; 7 of 12 had a shallower maximum drawdown than holding (16.0%).
What was the best strategy for XLP?
RSI(2) snapback had the highest CAGR at 8.22% with a max drawdown of 11.06%, against 5.80% and 15.99% for holding. RSI(14) mean reversion made 6.51% with a 9.64% drawdown and an 81% win rate. Only these two beat buy-and-hold.
Did any strategy beat buying and holding XLP?
Two of twelve did on CAGR. Seven had a shallower max drawdown than the fund's 15.99%, and nine had a positive CAGR. RSI(14) mean reversion is the only one that stayed ahead of holding with 10 basis points of slippage.
Why did the dip buyer only trade once on XLP?
XLP fell 10% or more from a 20-day high only once in the window, for 3 sessions. The dip buyer entered on 2022-05-19 and exited on 2022-08-15 for 8.00%. That is 4.1% exposure and a 1.32% CAGR.
Do trend-following rules work on XLP?
Not in this window. The golden cross made 2.05%, the trend plus trailing stop 1.82%, EMA 12/26 1.19% and SMA 10/50 1.21%. The 200-day regime filter lost 0.81%. XLP crossed its 200-day average 73 times.
How do trading costs affect XLP strategies?
RSI(2) snapback fell from 8.22% to 2.26% at 10 basis points because it makes 333 fills. RSI(14) fell from 6.51% to 5.93%. The weekly 7% target went from 2.37% to -0.11%.
How volatile is XLP compared with other sector funds?
Annualized volatility was 13.28% and the deepest drawdown was 16.27%. Its beta to SPY was 0.38 and its correlation to SPY was 0.47. It had one fall of 10% or more from a 20-day high.
Other sector etfs
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.