Learn › Strategies › 20-Day Momentum + Trailing Stop › XLP

20-Day Momentum + Trailing Stop 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.

Result: momentum breakout on XLP turned $10,000 into $8,975 (−10.3% total, −1.9% CAGR): it trailed buy-and-hold by 7.7% per year, with a maximum drawdown 1.5 points shallower than holding (14.5% vs 16.0%).
−1.9%CAGR
5.8%buy & hold CAGR
−14.5%max drawdown
-0.36Sharpe ratio
2round trips
0%win rate
■ momentum breakout   ■ buy & hold, $10,000 invested 2021-01-04

Year by year

Yearmomentum breakoutbuy & hold
20210.1%18.1%
2022−4.5%−0.7%
20230.0%−0.9%
20240.0%12.0%
20250.0%1.5%
2026−6.1%5.6%

Month by month

YearJanFebMarAprMayJunJulAugSepOctNovDec
20210.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.1%
2022−1.4%−1.3%1.5%2.5%−5.6%0.0%0.0%0.0%0.0%0.0%0.0%0.0%
20230.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%
20240.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%
20250.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%
20260.0%3.9%−9.6%0.0%0.0%0.0%0.0%0.0%0.0%0.0%––

Every trade

momentum breakout on XLP made 2 closed round trips, an average hold of 92 days, an average loser of −5.38%, a longest losing streak of 2. It held a position at the close on 8.8% of trading days.

EntryEntry priceExitExit priceReturnDays held
2021-12-30$67.942022-05-18$64.86−4.5%139
2026-02-04$84.892026-03-20$79.60−6.2%44

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.

Largest drawdowns

PeakLow pointDepthDays to lowRecoveredDays to recover
2022-04-202026-03-20−14.5%1430not yet–
2022-01-042022-03-11−7.8%662022-04-0626
2022-04-132022-04-18−0.8%52022-04-191

Buy-and-hold's deepest drawdown ran from 2022-04-20 to 2022-10-07 and reached −16.0%.

With trading costs

The headline run fills at the bar price. These runs charge slippage on every fill.

Slippage per fillCAGRMax drawdownFinal valueSharpe
None (headline)−1.9%−14.5%$8,975-0.36
5 basis points−1.9%−14.6%$8,956-0.36
10 basis points−1.9%−14.8%$8,937-0.37

Changing the parameters

VersionCAGRMax drawdownRound tripsWin rateFinal value
Published rules−1.9%−14.5%20%$8,975
5% trailing stop−1.2%−7.1%30%$9,354
15% trailing stop−2.6%−18.9%10%$8,587
20% return entry0.0%−0.0%0–$10,000

How XLP behaved

MeasureXLP
Data in this test2021-01-04 to 2026-10-02 (1444 sessions)
Total return, buy and hold40.3%
Annualized volatility13.3%
Deepest drawdown−16.3% (2022-04-20 to 2022-10-07)
Up days51.6%
Average daily range1.12%
Average overnight gap0.29%
Correlation to SPY0.47
Correlation to QQQ0.30
Correlation to TLT0.13
Sessions above the 200-day average75.1%
Crossings of the 200-day average73
Falls of 10% or more from a 20-day high1

The rules

Buy after a +10% four-week burst and let a 10% trailing stop manage the exit.

  1. WHEN the market opens · IF not invested AND the 20-day return > +10% · THEN buy with 98% of the sleeve
  2. WHILE invested · a managed trailing stop follows 10% below the position's high-water mark

Momentum entry, trailing-stop exit. A +10% gain over 20 sessions marks a burst of momentum. The template buys the strength and exits on a 10% trailing stop that ratchets up beneath the highest close and never moves down. There is no profit target, so winners run until the trail is hit.

Good for: high-momentum assets where trends extend, such as semiconductor and leveraged tech ETFs.
Watch out: buying strength means buying high; when a burst immediately reverses, the trail exits about 10% below the entry.

Run momentum breakout on XLP yourself, free →

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 momentum breakout beat buy-and-hold on XLP?

Over 2021-01-04 to 2026-10-02, momentum breakout on XLP returned −1.9% annualized vs 5.8% for buy-and-hold: it trailed buy-and-hold by 7.7% per year, with a maximum drawdown 1.5 points shallower than holding (14.5% vs 16.0%).

How many trades did it make?

2 completed round trips over 5.7 years (4 fills), with 0% of round trips closing profitably.

How does the trailing stop work in the backtest?

The stop sits 10% below the highest price since entry and only ratchets up. When a bar trades through it, the position sells at the stop, or at the open if the price gaps below it. Trailing-stop exits can be backtested now; deploying them live is not available yet.

Related

20-Day Momentum + Trailing Stop on all 59 ETFsfull results table All strategies on XLP12 templates compared RSI(14) Mean Reversion on XLPsame ETF, different rulesRSI(2) Dip Snapback on XLPsame ETF, different rules

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.