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

20-Day Momentum + Trailing Stop on XLK

Technology Select Sector SPDR Fund: S&P 500 technology stocks, the sector behind most recent bull runs. 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 XLK turned $10,000 into $18,797 (88.0% total, 11.6% CAGR): it trailed buy-and-hold by 10.5% per year, with a maximum drawdown 6.8 points shallower than holding (26.1% vs 33.0%).

Only a burst of strength gets the momentum breakout rule into a fund. Once the 20-day return is above +10%, it buys using 98% of the sleeve at the following open, then trails a stop 10% under the highest close since entry. A winner runs until the stop catches it, since no profit target exists. XLK, the Technology Select Sector SPDR Fund, holds the S&P 500 technology stocks. From 2021-01-04 through 2026-10-02 the rule took $10,000 to $18,797, a CAGR of 11.62% and a total return of 87.97%. Holding XLK grew the same $10,000 to $31,425, a CAGR of 22.07%.

The rule closed 9 round trips and 5 of them won, a rate of 56%. Winners averaged 19% and losers averaged -5.31%, which gives a profit factor of 4.91. The best trade returned 28.32% and the worst lost 9.77%. Average hold time was 134.4 days, and the account was in the fund on 57.7% of days. The Sharpe ratio was 0.8 against 0.95 for holding, and max drawdown was 26.14% against 32.96%.

The profile is the one the strategy page describes: small, quick losses and long, large wins. It gave up a lot of return against a fund that doubled and then some, and it did so with a shallower worst drawdown. By CAGR the rule is 7th of 12 strategies on XLK, and XLK is 7th of 59 funds for this rule. The figures are hypothetical, from one 5.74-year window, with no fees in the headline run.

11.6%CAGR
22.1%buy & hold CAGR
−26.1%max drawdown
0.80Sharpe ratio
9round trips
56%win rate
■ momentum breakout   ■ buy & hold, $10,000 invested 2021-01-04

Year by year

Yearmomentum breakoutbuy & hold
202122.1%36.1%
2022−24.2%−27.2%
202326.3%54.6%
202415.6%21.3%
202520.2%24.3%
202615.7%38.9%

What each calendar year did

The rule returned 22.1% in 2021, -24.2% in 2022, 26.3% in 2023, 15.6% in 2024, 20.2% in 2025 and 15.7% in 2026 to date. Holding XLK returned 36.1%, -27.2%, 54.6%, 21.3%, 24.3% and 38.9%. The rule trailed in five of the six years and led in 2022 by 3 points. The widest gaps were 28.3 points in 2023 and 23.2 in 2026.

2021 started with three idle months. January, February and March show 0%, since the 20-day return had not passed +10%, and the first entry came on 2021-04-19 at 68.48. The rule then rode that position through the summer and autumn, with June at 6.71%, July at 3.81% and August at 3.48%, and exited on 2022-01-20 at 76.923 for a 12.33% gain over 276 days. That is the longest hold in the record. The calendar-year 22.1% against 36.1% for holding is the cost of the missed first quarter and a September at -5.74%.

2022 was the weak year for both, and the rule's result of -24.2% was only a little better than the -27.2% of holding. The reason is the trade log. The rule made four round trips exiting in 2022 and only one of them won, the 12.33% carry-over from 2021. The other three lost 9.77%, 4.06% and 5.04%. Inside the 2022 decline the fund produced short bursts above +10%, the rule bought them, and the trailing stop sold each position lower. That is the behaviour the caveat on the strategy page warns about: buying strength means buying high.

2023 was the year the rule lagged most. XLK returned 54.6% and the rule returned 26.3%. The rule did well in the trades it made: the entry on 2023-01-27 at 66.06 closed on 2023-08-18 at 79.83 for 20.84%, and a second entry on 2023-11-20 started a position that ran well into 2024. The gap comes from time out. After the August 2023 exit, which cost 8.44% in the month, the rule sat in cash for September and October, and the fund kept rising. The 20-day return on a steady grind rarely tops +10%, so the rule has no entry in a steady bull market.

2024 and 2025 were closer. The rule returned 15.6% against 21.3% in 2024 and 20.2% against 24.3% in 2025. The 2025 result included the best trade of the window, the entry on 2025-05-05 at 106.76 that closed on 2025-11-20 at 136.998 for 28.32%. 2026 to date shows 15.7% against 38.9%. The 2026 row is a partial year, and the rule has been in cash since the exit on 2026-06-09.

Month by month

YearJanFebMarAprMayJunJulAugSepOctNovDec
20210.0%0.0%0.0%−2.0%−0.9%6.7%3.8%3.5%−5.7%8.0%4.3%3.2%
2022−8.2%0.0%0.0%−9.6%0.0%0.0%1.2%−5.1%0.0%0.0%2.9%−7.6%
20230.4%0.4%10.6%−0.1%8.7%6.0%2.5%−8.4%0.0%0.0%0.8%4.1%
20242.6%4.6%0.8%−5.7%7.0%7.6%−5.2%0.0%0.0%−1.0%5.0%−0.3%
2025−0.7%−2.2%−2.9%0.0%7.0%9.6%3.6%0.0%7.4%6.5%−8.2%0.0%
20260.0%0.0%0.0%3.4%19.4%−6.3%0.0%0.0%0.0%0.0%––

Months by month

The rule's best month was May 2026 at 19.36%, and holding's best was April 2026 at 19.71%. The worst month for the rule was April 2022 at -9.55%, and holding's was September 2022 at -11.65%. The rule's worst month is the same one as the worst trade: the entry on 2022-04-05 at 77.74 closed on 2022-04-22 at 70.146, a 17-day loss of 9.77%.

Strong months cluster in a few runs. March 2023 gained 10.62%, May 2023 gained 8.72% and June 2023 gained 5.97%. October 2021 gained 8.04%. May 2024 gained 7.03% and June 2024 gained 7.62%. May 2025 gained 7.03%, June 2025 gained 9.61%, September 2025 gained 7.4% and October 2025 gained 6.46%. The pattern is long runs in the fund, captured after a delay.

The weak months follow turning points. January 2022 lost 8.23% and December 2022 lost 7.58%. August 2023 lost 8.44%, and November 2025 lost 8.21%. June 2026 lost 6.26% after May's 19.36%, and the exit came during June. The rule's own best month in 2026 was followed by a drawdown of 9.56% from 2026-06-02 to 2026-06-09, which is the shortest of the three listed drawdowns and still open at the end.

Zeros are frequent. Many months in the table show 0%, because no position was held. They include most of the spring and summer of 2022, September and October 2023, August and September 2024, and the months from July 2026 on. A rule that waits for a +10% burst spends a fair share of the calendar in cash.

Every trade

momentum breakout on XLK made 9 closed round trips, an average hold of 134 days, an average winner of 19.00%, an average loser of −5.31%, a profit factor of 4.91, a longest losing streak of 3. It held a position at the close on 57.7% of trading days.

EntryEntry priceExitExit priceReturnDays held
2021-04-19$68.482022-01-20$76.9212.3%276
2022-04-05$77.742022-04-22$70.15−9.8%17
2022-07-29$69.082022-08-30$66.28−4.1%32
2022-11-14$64.192022-12-19$60.96−5.0%35
2023-01-27$66.062023-08-18$79.8320.8%203
2023-11-20$90.112024-07-25$105.7617.4%248
2024-10-07$110.962025-03-03$108.34−2.4%147
2025-05-05$106.762025-11-20$137.0028.3%199
2026-04-17$153.642026-06-09$178.4316.1%53

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 nine trades

All nine trades are listed below with adjusted prices.

Winners are long and losers are short. The five winners held between 53 and 276 days and returned 12.33% to 28.32%. The losers held 17 to 147 days and lost 2.36% to 9.77%. That asymmetry is the trailing stop at work. A 10% stop under the high-water mark caps a quick reversal near a 10% loss from the entry, and the actual losses were 9.77%, 5.04%, 4.06% and 2.36%, all inside that cap. A position that keeps rising never meets the stop, and the five wins stayed in until the trail finally hit.

The profit factor of 4.91 says gross profit was far above gross loss, and it comes from the wins at 19% on average against losses at -5.31%. The win rate of 56% is modest. The longest winning streak was 2 and the longest losing streak was 3, and the three losses in a row were the three 2022 trades. The median trade returned 12.33% and the median hold was 147 days.

The 2024-10-07 entry shows the stop doing its job. It held 147 days and ended at -2.36% when the trail was hit on 2025-03-03, ahead of the sharp decline into April 2025. The fund's worst days were in that stretch, -6.76% on 2025-04-03 and -6.57% on 2025-04-04. The rule was already in cash for them. It re-entered on 2025-05-05 and caught most of the recovery.

Two positions in detail: late 2024 and spring 2026

The 2024-10-07 entry at 110.96 is the clearest case of a stop that took a long time to trigger. October 2024 showed -0.98% for the rule, November gained 5.03%, and then December, January, February and March were negative at -0.31%, -0.74%, -2.19% and -2.94%. The position closed on 2025-03-03 at 108.342 for -2.36% after 147 days, the mildest loss of the four losing trades.

The entry on 2026-04-17 at 153.64 went the other way. April showed 3.42% and May 19.36%, the rule's best month, which sat close to the fund's own best month of 19.71% in April 2026. The exit came on 2026-06-09 at 178.434 for 16.14% in 53 days, the shortest winning hold of the nine. June showed -6.26%, and the 9.56% drawdown measured from 2026-06-02 to 2026-06-09 comes entirely from this exit stretch.

The 2025-11-20 exit after the 28.32% trade shows the same pattern at a smaller scale. November 2025 lost 8.21% in the rule's account, in the month that closed a winner. A trailing stop gives back up to a tenth of the peak before it sells, so even winning trades end with a visible monthly loss.

Largest drawdowns

PeakLow pointDepthDays to lowRecoveredDays to recover
2021-12-272023-01-30−26.1%3992024-02-08374
2024-07-102025-05-06−12.4%3002025-06-2449
2026-06-022026-06-09−9.6%7not yet–

Buy-and-hold's deepest drawdown ran from 2021-12-27 to 2022-10-12 and reached −33.0%.

The drawdowns

The deepest drawdown was 26.14%, from a peak on 2021-12-27 to a low on 2023-01-30, 399 days later, and it recovered on 2024-02-08 after 374 days more. The second was 12.41%, from 2024-07-10 to 2025-05-06, 300 days to the low, recovered on 2025-06-24. The third was 9.56%, from 2026-06-02 to 2026-06-09, not yet recovered at the end.

Holding XLK had three larger drawdowns of 32.96%, 25.29% and 16.74%. The first ran from 2021-12-27 to 2022-10-12 and recovered on 2023-06-15 after 246 days. The second ran from 2025-02-18 to 2025-04-08 and recovered on 2025-06-12, and the third from 2024-07-10 to 2024-08-07, recovered on 2024-11-07. The rule's deepest drawdown was shallower by 6.82 points.

The deepest drawdown of the rule shares its peak date with the fund's, 2021-12-27, though the rule's low came later, on 2023-01-30, after the fund's own low of 2022-10-12. The rule exited on 2022-01-20 and bought and sold three times in 2022, taking the 9.77%, 4.06% and 5.04% losses on the way down. The repeated entries added a series of losses to the account while the fund was falling.

The rule avoided the worst of 2025. Holding saw a 25.29% drop from 2025-02-18 to 2025-04-08, while the rule's second drawdown was 12.41%. The trail exit on 2025-03-03 explains most of that difference.

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)11.6%−26.1%$18,7970.80
5 basis points11.4%−26.5%$18,6110.79
10 basis points11.3%−26.8%$18,4970.78

Cost runs

The headline run has no fees. A cost of 5 basis points gave a CAGR of 11.43%, a max drawdown of 26.46% and an end equity of $18,611. A cost of 10 basis points gave 11.31%, 26.76% and $18,497. The Sharpe ratio fell from 0.8 to 0.788 and 0.78.

The rule made 18 fills, and the cost matters less than on a rule that trades daily. Size is no issue on XLK, which trades $1,324,049,811 on an average day and 20,984 shares in a median minute. Each cost run adds a flat charge per fill. They show the CAGR drifting down with each added 5 basis points, which fits 18 fills. The real spread was not measured.

Changing the parameters

VersionCAGRMax drawdownRound tripsWin rateFinal value
Published rules11.6%−26.1%956%$18,797
5% trailing stop2.9%−14.3%1644%$11,777
15% trailing stop7.9%−38.8%757%$15,492
20% return entry4.8%−10.4%2100%$13,112

Trailing stop and entry variants

Three variants changed one setting.

The base setting of a 10% entry and a 10% trail returned 11.62% with a 26.14% drawdown. The stop distance mattered more than anything. A 5% trail made 16 trades and returned 2.89%, so the stop sold ordinary pullbacks and the rule paid for them again and again. A 15% trail made 7 trades and returned 7.92% with a drawdown of 38.75%, deeper than holding's 32.96%. Each variant's result sits below the base case, which makes 10% the best of the settings tried on this fund in this window. That describes these 5.74 years only.

The 20% entry waited for a much stronger burst and made only 2 trades, both wins. It returned 4.83% with a max drawdown of 10.42% and a Sharpe ratio of 0.716, the shallowest drawdown among the variants. It sat in cash for most of the window. Its result rests on two positions, and the comparison with the base rule shows how much of XLK's rise came without a +20% burst.

How XLK behaved

MeasureXLK
Data in this test2021-01-04 to 2026-10-02 (1444 sessions)
Total return, buy and hold226.1%
Annualized volatility25.1%
Deepest drawdown−33.6% (2021-12-27 to 2022-10-12)
Up days55.2%
Average daily range1.77%
Average overnight gap0.69%
Correlation to SPY0.91
Correlation to QQQ0.97
Correlation to TLT0.07
Sessions above the 200-day average76.5%
Crossings of the 200-day average22
Falls of 10% or more from a 20-day high30

How XLK behaved

Across 1,444 sessions XLK gained 226.13%, compounding at 22.86% a year with annualized volatility of 25.13%. The fund's worst fall was 33.58%, starting 2021-12-27, bottoming 2022-10-12 and healing by 2023-06-15. Yearly figures: 36.99%, -27.73%, 56.01%, 21.64% and 24.61% for 2021 to 2025, and 39.31% so far in 2026.

Up days made 55.23% of sessions, averaging 1.15%, and down days averaged -1.21%. One session gained 13.37%, on 2025-04-09, and the roughest lost 6.76%, on 2025-04-03. The best day arrived days after the worst. The rule could not catch it, because it had been in cash since 2025-03-03 and re-entered only on 2025-05-05. Autocorrelation at lag 1 was -0.03, so the days were close to independent.

Price sat above the 200-day average on 76.47% of sessions and crossed it 22 times, which describes a long uptrend with a few breaks. It is the setting where a momentum entry should work, because the fund has long persistent legs, and the results show the idea works in part: the wins averaged 19%. The cost is the entry delay. A +10% move in 20 sessions means the fund has already run before the rule buys.

Thirty times the fund fell more than 10% inside a 20-session window, over 96 days in all. It also had 15 sessions with RSI(14) below 30 and 153 sessions above 70, so the fund spent a lot of time in overbought territory. A rule built on strength fits that profile. Following RSI(14) readings under 30, the median 5-day gain was 4.01% (baseline 0.5%) and the 20-day median was 4.4% (baseline 1.9%), from only 15 sessions.

XLK is highly correlated with the market. Betas of 1.39 to SPY and 1.08 to QQQ come with correlations of 0.91 and 0.97, and it was close to unrelated to TLT at 0.07. The funds most correlated with it were TECL at 1, ROM at 0.99, and TQQQ and QQQ at 0.97. Seasonal averages show May at 7.38% and November at 4.79%, and September at -1.48%, over 5 or 6 observations each.

Overnight, weekday and month-of-year patterns in XLK

XLK earned 64.18% in log terms overnight and 51.87% during the session, so the overnight share was 55.3% and the intraday share 44.7%. The average overnight gap was 0.69% and the average intraday range was 1.77%. The rule signals on a close and buys at the next open, which puts that gap into the entry price on every trade.

Weekday averages were small. Monday averaged 0.21% and Wednesday 0.16%, while Tuesday, Thursday and Friday were 0.02%, 0.05% and 0.04%. Nothing about the entry weekday separates the trades.

The month-of-year averages are larger and rest on 5 or 6 observations each. October averaged 4.19%, June 3.52% and July 2.05%, with May far ahead at 7.38%. February averaged -0.7% and September -1.48%. The rule's own May figures were -0.89% in 2021, 0% in 2022 and positive in 2023, 2024, 2025 and 2026. In September the rule posted -5.74% in 2021 and 0% in 2022, 2023 and 2024, then 7.4% in 2025.

RSI(2) closed below 10 on 137 sessions. The median 5-day forward return after them was 0.6% against a baseline of 0.5%, and the median 20-day return was 2.59% against 1.9%. Short-term dips in XLK were followed by results close to the ordinary drift.

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.

Why the rule held up on technology

The strategy page names semiconductor and leveraged tech funds as the fit, since trends there extend. XLK is a broad technology fund with lower volatility than those, and the rule's 11.62% placed XLK 7th of 59 funds. The rule fared best where the fund trended in clear legs: 2023, the 2025 recovery and the spring of 2026.

Six strategies ranked above the momentum breakout on XLK. The monthly cycle took first place with 20.86%, with the weekly 7% target close at 20.39%. Trend filters came next: the 200-day regime filter at 16.81% and the golden cross at 15.33%. A trailing-stop trend rule made 12.49%, and the RSI(2) snapback made 12.11%. Five sit lower: the EMA 12/26 trend with 9.84%, the SMA 10/50 trend with 9.47%, RSI mean reversion with 8.74%, the dip buyer with 7.85% and 3-month momentum with 6.06%.

Sector-fund results for this rule start with SOXX, which made 16.73% over 18 round trips. XLK made 11.62%. XLF made 6.99%, XLY 3.83% and VOX 2.19%, while XLP lost 1.87%. Sector funds had a median of 6.99% and all 59 funds had a median of 0%, so XLK sits above both.

The test covers one fund, one set of rules and 5.74 years. A rule that gave up half the fund's CAGR in exchange for a shallower drawdown had a good window in which to try, since XLK rose in most of it. Nine trades make a small sample, and the figures are hypothetical.

Run momentum breakout on XLK 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 XLK?

Over 2021-01-04 to 2026-10-02, momentum breakout on XLK returned 11.6% annualized vs 22.1% for buy-and-hold: it trailed buy-and-hold by 10.5% per year, with a maximum drawdown 6.8 points shallower than holding (26.1% vs 33.0%).

How many trades did it make?

9 completed round trips over 5.7 years (18 fills), with 56% 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.

How did the momentum breakout do on XLK?

It returned a CAGR of 11.62% from 2021-01-04 to 2026-10-02, turning $10,000 into $18,797. Holding XLK returned 22.07% and ended at $31,425. The rule's max drawdown was 26.14% against 32.96% for holding.

Why did the rule trail buy-and-hold on XLK?

It only buys after a +10% 20-day burst and sells on a 10% trailing stop, so it spends a large share of days in cash. XLK rose in most months, and the rule missed the early part of each run. It beat holding in 2022 only, 3 points ahead.

What was the best trade on XLK?

The entry on 2025-05-05 at 106.76, which closed on 2025-11-20 at 136.998 for a gain of 28.32% over 199 days. The trailing stop ended it. The next best was 20.84% from 2023-01-27 to 2023-08-18.

How did the rule do in 2022?

It returned -24.2% against -27.2% for holding. It made four round trips that exited in 2022 and only one won. The three losses were 9.77%, 4.06% and 5.04%.

What happens with a tighter or looser trailing stop on XLK?

A 5% stop returned 2.89% with 16 trades, and a 15% stop returned 7.92% with a 38.75% drawdown. The 10% base stop returned 11.62%. Both alternatives finished below it.

Do trading costs matter for the momentum breakout on XLK?

A little. At 5 basis points the CAGR was 11.43%, and at 10 basis points it was 11.31%. The rule made 18 fills and XLK is very liquid.

Related

20-Day Momentum + Trailing Stop on all 59 ETFsfull results table All strategies on XLK12 templates compared RSI(14) Mean Reversion on XLKsame ETF, different rulesRSI(2) Dip Snapback on XLKsame 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.