SMA-200 Trend + 15% 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.
Seven closed trades, four of them winners, took $10,000 to $19,653 on XLK, the Technology Select Sector SPDR Fund. The trend plus trailing stop template buys when yesterday's close is above the 200-day average and then holds until a stop 15% below the position's highest close is hit. From 2021-01-04 to 2026-10-02 that gave a CAGR of 12.49%, a maximum drawdown of 32.53% and a Sharpe ratio of 0.7.
XLK rose strongly in the window, and buy-and-hold on it returned 22.07% a year and ended at $31,425. The rule trailed by 9.58 points a year. Its drawdown of 32.53% was almost the same as buy-and-hold's 32.96%, a difference of 0.43 points, so on this fund the stop gave up return and kept nearly all of the fund's worst fall.
The trade record has a clear shape. The average winner returned 23.91% and the average loser -8.99%, which made a profit factor of 3.82. The best trade ran 556 days and returned 53.55%. The rule was invested 71.4% of the time, with an average hold of 204 days, so each trade is closer to a position than a signal.
Among the twelve templates on XLK this one ranked 5th, and XLK ranked 9th of 59 funds for the rule. Over all 59 funds the median for this rule was 2.61% and over the sector funds 8.57%, which puts XLK at 12.49% among the better results. The test is a hypothetical backtest on one window of 5.7 years with no costs in the first set of numbers.
Year by year
| Year | trend + trailing stop | buy & hold |
|---|---|---|
| 2021 | 10.4% | 36.1% |
| 2022 | −31.5% | −27.2% |
| 2023 | 44.2% | 54.6% |
| 2024 | 28.3% | 21.3% |
| 2025 | 12.2% | 24.3% |
| 2026 | 25.2% | 38.9% |
Year by year
The rule returned 10.4% in 2021, -31.5% in 2022, 44.2% in 2023, 28.3% in 2024, 12.2% in 2025 and 25.2% in 2026 so far. Buy-and-hold returned 36.1%, -27.2%, 54.6%, 21.3%, 24.3% and 38.9%. The rule beat the fund in one year, 2024, by 7 points.
2022 stands out because the rule did worse than the fund in a falling year, losing 31.5% against 27.2%. A trend filter with a stop is meant to step aside in a bear market, and it did not here. The rule held XLK through the January to May decline and again from August to September, and it lost on all three trades of the year: -4.28%, -8.27% and -14.42%. The monthly table shows -7.7% in January, -4.8% in February, -10.7% in April, -10.1% in August and -4.5% in September. Only March, at 3.3%, was positive. From October to December 2022 the rule was in cash, after the September stop-out.
The reason is in the rule. Entry needs only one close above the 200-day average, and bear markets contain rallies that cross it. The rule bought on 2022-01-25 at $73.42 and sold on 2022-05-06 at $67.35, then bought on 2022-08-16 at $73.14 during a summer rally and sold on 2022-09-15 at $62.59, a loss of 14.42% in 30 days that was the worst trade of the test. The stop is wide at 15% of the peak, so each failed rally costs a large part of that.
2021 shows another effect. The rule was in cash until 2021-10-19, with 0.0% from January through September, and returned 10.4% against 36.1% for the fund, a gap of 25.7 points. The 200-day average cannot be computed before 200 sessions have passed, which fits an entry in the second half of October. That first trade lost 4.28% by 2022-01-24 after 97 days.
2023 was the best year, at 44.2% against 54.6%. The 556-day trade began on 2023-01-24 at $65.05 and runs through 2024-08-02. Its monthly gains include March at 10.6%, May at 8.7% and November at 12.6%. The gap to the fund of 10.4 points is the price of entering in late January instead of holding from the start.
2024 is the one winning year against buy-and-hold: 28.3% against 21.3%. The long trade exited on 2024-08-02 at $99.88 for 53.55%, just before the August 2024 drop, and the rule re-entered on 2024-08-05 at $94.16. That entry was a lower price than the exit, and it began the 218-day trade that returned 8.67%. In 2025 the rule returned 12.2% against 24.3%, and in 2026 so far 25.2% against 38.9%.
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% | 2.5% | 4.3% | 3.2% |
| 2022 | −7.7% | −4.8% | 3.3% | −10.7% | −1.5% | 0.0% | 0.0% | −10.1% | −4.5% | 0.0% | 0.0% | 0.0% |
| 2023 | 1.9% | 0.4% | 10.6% | −0.1% | 8.7% | 5.9% | 2.5% | −1.5% | −6.3% | 0.1% | 12.6% | 4.1% |
| 2024 | 2.6% | 4.6% | 0.8% | −5.7% | 7.0% | 7.6% | −3.2% | 6.6% | 2.6% | −1.5% | 5.0% | −0.3% |
| 2025 | −0.7% | −2.2% | −8.2% | 0.0% | 1.0% | 9.6% | 3.6% | 0.0% | 7.4% | 6.5% | −4.7% | 0.7% |
| 2026 | −0.1% | −3.5% | −6.3% | 12.2% | 19.4% | −0.2% | −9.0% | 6.2% | 5.0% | 2.1% | – | – |
Month by month
The monthly table has long zero blocks: January to September 2021, June and July 2022, October to December 2022, April 2025 and August 2025. Those are the rule's cash months. The monthly profile otherwise looks like XLK's own, with larger swings than most funds in the data.
The rule's best month was May 2026 at 19.43%, followed by April 2026 at 12.2%. Buy-and-hold's best was April 2026 at 19.71%. The rule's worst month was April 2022 at -10.71%, and buy-and-hold's worst was September 2022 at -11.65%. The rule lost 9.0% in July 2026 and had a fresh trade begin on the day after the stop was hit.
The fund's own calendar helps read these. XLK averaged 7.38% in May, 4.79% in November and 4.19% in October across the years in the data, and -1.48% in September. The rule's Mays were 0.0% in 2021, -1.5% in 2022, 8.7% in 2023, 7.0% in 2024, 1.0% in 2025 and 19.4% in 2026. Its Septembers were 0.0% in 2021, -4.5% in 2022, -6.3% in 2023, 2.6% in 2024, 7.4% in 2025 and 5.0% in 2026.
March of 2025 and 2026 show what the stop does to a drawdown: -8.2% and -6.3%. In March 2025 the rule exited on 2025-03-11 at $102.32 for a gain of 8.67%, and in March 2026 it exited on 2026-03-27 at $129.39 for 14.22%. Both exits followed a fall, which is what a trailing stop does: it gives back a fixed fraction of the move before it sells.
Every trade
trend + trailing stop on XLK made 7 closed round trips and one position still open at the end of the test, an average hold of 204 days, an average winner of 23.91%, an average loser of −8.99%, a profit factor of 3.82, a longest losing streak of 3. It held a position at the close on 71.4% of trading days.
| Entry | Entry price | Exit | Exit price | Return | Days held |
|---|---|---|---|---|---|
| 2021-10-19 | $75.90 | 2022-01-24 | $72.65 | −4.3% | 97 |
| 2022-01-25 | $73.42 | 2022-05-06 | $67.35 | −8.3% | 101 |
| 2022-08-16 | $73.14 | 2022-09-15 | $62.59 | −14.4% | 30 |
| 2023-01-24 | $65.05 | 2024-08-02 | $99.88 | 53.5% | 556 |
| 2024-08-05 | $94.16 | 2025-03-11 | $102.32 | 8.7% | 218 |
| 2025-05-13 | $113.28 | 2026-03-27 | $129.39 | 14.2% | 318 |
| 2026-04-09 | $141.37 | 2026-07-28 | $168.52 | 19.2% | 110 |
| 2026-07-29 | $170.72 | open | – | 17.1% | – |
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 seven trades and the open position
The list holds 7 closed round trips and an 8th that was still open on the last day, bought on 2026-07-29 at $170.72 and marked at +17.06%. The median return was 8.67%, the median hold 110 days, the shortest hold 30 days and the longest 556. Four wins came in a row at best and three losses in a row at worst.
The three losers came first, in 2021 to 2022, and the four winners followed. The winners were 53.55% over 556 days, 19.21% over 110 days from 2026-04-09 at $141.37 to 2026-07-28 at $168.52, 14.22% over 318 days from 2025-05-13 at $113.28 to 2026-03-27 at $129.39, and 8.67% over 218 days. The losers were -14.42%, -8.27% and -4.28%. A small number of trades means one result can change the picture, and the 53.55% trade is the largest contribution by far.
The first loser, -4.28%, deserves a note. A 15% trailing stop is measured from the highest close since entry, not from the entry price. A position that rises before it falls can be stopped out near or below its entry price, and here the trade entered at $75.90 and exited at $72.65. The exit was a stop, not a decision that the trend had ended.
The last two entries show the other side of the rule. The stop hit on 2026-07-28 at $168.52, and the rule re-entered on 2026-07-29 at $170.72, because the close was still above the 200-day average. A trailing stop exit with an immediate re-entry costs the gap between the two prices and starts a new high-water mark at a higher base. The new position was marked at +17.06% at the last close.
By exit year, 2022 closed three trades and won none, while 2024 and 2025 each closed one winner and 2026 closed two. Nothing closed in 2021 or 2023. A seven-trade sample cannot say much about the win rate of 57%.
Largest drawdowns
| Peak | Low point | Depth | Days to low | Recovered | Days to recover |
|---|---|---|---|---|---|
| 2021-12-27 | 2022-09-15 | −32.5% | 262 | 2024-01-19 | 491 |
| 2026-06-02 | 2026-07-29 | −16.6% | 57 | not yet | – |
| 2025-02-18 | 2025-05-23 | −15.0% | 94 | 2025-08-12 | 81 |
Buy-and-hold's deepest drawdown ran from 2021-12-27 to 2022-10-12 and reached −33.0%.
The drawdowns
The rule's deepest drawdown was 32.53%, from the peak on 2021-12-27 to the low on 2022-09-15, 262 days later. It recovered on 2024-01-19, 491 days after the low. The second, 16.65%, ran from 2026-06-02 to a low on 2026-07-29 and was still open on the final day. The third was 14.97%, from 2025-02-18 to 2025-05-23, and it recovered on 2025-08-12.
Buy-and-hold's deepest drawdown was 32.96%, from the same peak date, 2021-12-27, to 2022-10-12, and it recovered on 2023-06-15. The fund's second was 25.29% in early 2025 and its third 16.74% in mid 2024. The rule's drawdown in 2025, at 14.97%, was shallower than the fund's 25.29%, and that is where the stop worked: the rule sold on 2025-03-11 and stayed out through April.
The 2022 drawdown was the problem. The rule's 32.53% is within half a point of the fund's, and its recovery, 491 days, was longer than the fund's 246. A stop that sits 15% below the peak, with entries on a 200-day signal, gave up about as much as holding in the one deep fall of the test.
Risk-adjusted, the rule scored a Sharpe ratio of 0.7 and buy-and-hold 0.95. The rule's return per unit of volatility was lower. The second drawdown, 16.65% from June to July 2026, ended with the stop-out of 2026-07-28, after the fund had risen.
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) | 12.5% | −32.5% | $19,653 | 0.70 |
| 5 basis points | 12.4% | −32.6% | $19,580 | 0.70 |
| 10 basis points | 12.3% | −32.9% | $19,440 | 0.69 |
With trading costs
The first run carries no costs. Charging 5 basis points a fill gave a CAGR of 12.42%, a drawdown of 32.65% and a final value of $19,580. At 10 basis points the CAGR was 12.28%, the drawdown 32.85% and the final value $19,440. The Sharpe ratio stayed at 0.7 and then 0.692.
The rule made 15 fills in 5.7 years. The CAGR moved only from 12.49% to 12.28% between the headline and the 10 basis point run. A trend rule with a wide stop trades rarely, and an average winner of 23.91% is large next to any plausible friction.
XLK is liquid. Its average daily dollar volume was about $1,324,049,811 and its median minute volume 20,984 shares. Fills near the bar price are realistic on a fund this size for a small account. The cost runs add a fixed amount per fill and do not model a stop that fills below its trigger in a fast fall, which could matter in a month like April 2022.
Changing the parameters
| Version | CAGR | Max drawdown | Round trips | Win rate | Final value |
|---|---|---|---|---|---|
| Published rules | 12.5% | −32.5% | 7 | 57% | $19,653 |
| 10% trailing stop | 14.4% | −28.0% | 13 | 54% | $21,667 |
| 20% trailing stop | 7.5% | −45.8% | 4 | 25% | $15,190 |
| 25% trailing stop | 7.2% | −42.5% | 3 | 33% | $14,868 |
Changing the stop
Three variants changed the stop width. A 10% stop returned 14.42% a year with a 27.96% drawdown, 13 trades and 7 winners, ending at $21,667 with a Sharpe ratio of 0.843. A 20% stop returned 7.55% with a 45.77% drawdown, 4 trades and 1 winner, ending at $15,190. A 25% stop returned 7.15% with a 42.54% drawdown, 3 trades and 1 winner, ending at $14,868.
The tighter stop was better on both return and drawdown. It made 13 trades against 7, took smaller losses on failed rallies and re-entered after shakeouts. The wider stops were worse: with 20% and 25%, each fall had to go deeper before the rule sold, and the drawdowns grew to 45.77% and 42.54%. The published 15% sits between them in return and between them in drawdown.
In this window, a stop that is too wide loses the benefit of stopping. XLK fell 33.58% from peak to trough in 2022, and a stop 25% below the peak sells only after most of that fall has happened. The ordering of the variants, 10% best and 20% and 25% worst, holds on this fund and this window only. Another fund might give another ordering.
The variants show the rule's sensitivity: the CAGR ranged from 7.15% to 14.42% across stop widths, with the published rule at 12.49%. The table is a sensitivity check, and the published width was not tuned on this data.
How XLK behaved
| Measure | XLK |
|---|---|
| Data in this test | 2021-01-04 to 2026-10-02 (1444 sessions) |
| Total return, buy and hold | 226.1% |
| Annualized volatility | 25.1% |
| Deepest drawdown | −33.6% (2021-12-27 to 2022-10-12) |
| Up days | 55.2% |
| Average daily range | 1.77% |
| Average overnight gap | 0.69% |
| Correlation to SPY | 0.91 |
| Correlation to QQQ | 0.97 |
| Correlation to TLT | 0.07 |
| Sessions above the 200-day average | 76.5% |
| Crossings of the 200-day average | 22 |
| Falls of 10% or more from a 20-day high | 30 |
How XLK behaved
XLK holds the S&P 500's technology stocks. It returned 226.13% over the window, 22.86% a year, with annualized volatility of 25.13% and a deepest drawdown of 33.58% from 2021-12-27 to 2022-10-12, recovered on 2023-06-15. By calendar year the fund made 36.99% in 2021, lost 27.73% in 2022, and then gained 56.01%, 21.64% and 24.61% in 2023, 2024 and 2025, with 39.31% so far in 2026.
The fund rose on 55.23% of days, with an average up day of 1.15% and an average down day of -1.21%. Its beta to SPY was 1.39 and to QQQ 1.08, and its correlation to SPY was 0.91 and to QQQ 0.97. On 2025-04-09 the fund gained 13.37% in a day, and its worst session was -6.76% on 2025-04-03, followed by -6.67% on 2026-06-05 and -6.57% on 2025-04-04.
For this rule the relevant numbers are about the 200-day average. XLK closed above it on 76.47% of sessions and crossed it 22 times. With few crossings, the entry signal was in place most of the time. The rule's own exposure was 71.4%, partly because it waited for the average in 2021 and sat out the end of 2022. Falls of 10% or more from a 20-day high happened 30 times and covered 96 days.
The RSI figures add context. On 15 sessions the 14-day RSI closed under 30. The median return over the next 5 days was 4.01% and over the next 20 days 4.4%, where any day averaged 0.5% and 1.9%. Oversold readings in this window were followed by rebounds. A trend rule does not use that information. The overnight share of return was 55.3% and the intraday 44.7%.
The rules
Enter when price is above the 200-day average; exit only when a 15% trailing stop is hit.
- WHEN the market opens · IF not invested AND yesterday's close > SMA(200) · THEN buy with 98% of the sleeve
- WHILE invested · a managed trailing stop follows 15% below the position's high-water mark
A hybrid of the regime filter and the trailing stop. The 200-day average decides when to get in, and a 15% trail from the position's high-water mark decides when to get out. Winners can run well past the point where a crossover would have exited, and the position gives back 15% from every peak.
Good for: long trends with moderate pullbacks; the 15% trail is wide enough to survive normal corrections.
Watch out: every exit gives back 15% from the peak, and on choppy assets it re-enters above the 200-day repeatedly after each stop-out.
How the rule fits this fund
Mechanically, the template enters with 98% of the sleeve at the open once yesterday's close is above the 200-day average, and a managed trailing stop then follows the position's high-water mark down 15%. The description calls it a hybrid of the regime filter and the trailing stop, with the 200-day average deciding when to get in and the trail deciding when to get out. It suits long trends with moderate pullbacks, and it warns that every exit gives back 15% from the peak and that choppy assets re-enter above the 200-day repeatedly after each stop-out.
XLK is a long-trend fund, and the winners fit that description: 556 days, 318 days, 218 days and 110 days. The 2022 sequence fits the warning, with three entries in a year and three losses. On this fund the template ranked 5th of 12. The monthly cycle led with 20.86% and a 32.05% drawdown, followed by the weekly 7% target at 20.39%, the 200-day regime filter at 16.81% with a 19.72% drawdown and the golden cross at 15.33% with 19.6%. Behind the template were the RSI(2) snapback at 12.11%, the momentum breakout at 11.62%, the EMA 12/26 trend rule at 9.84%, the SMA 10/50 trend rule at 9.47%, the RSI mean reversion rule at 8.74%, the dip buyer at 7.85% and the 3-month momentum rule at 6.06%.
The comparison with the plain 200-day filter is direct. The filter returned 16.81% with a 19.72% drawdown, and this template returned 12.49% with a 32.53% drawdown. The filter exits when price closes below the average, which is a tighter exit than a 15% trail, and it was better on both return and drawdown on XLK. The trailing stop's advantage is staying in long trends through shallow pullbacks, and the filter did that well enough on this fund.
Among sector funds, the same rule returned 19.81% on SOXX, 8.57% on VOX, 2.62% on XLF, 1.82% on XLP and -4.4% on XLY, which had a 39.69% drawdown. XLK was second. The funds with the strongest rises did best. The XLK page compares all templates on the fund and the trend plus trailing stop page has the table for all 59.
One fund, one window, daily decisions. These numbers are not 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 trend + trailing stop beat buy-and-hold on XLK?
Over 2021-01-04 to 2026-10-02, trend + trailing stop on XLK returned 12.5% annualized vs 22.1% for buy-and-hold: it trailed buy-and-hold by 9.6% per year, with a maximum drawdown 0.4 points shallower than holding (32.5% vs 33.0%).
How many trades did it make?
7 completed round trips over 5.7 years (15 fills), with 57% of round trips closing profitably.
Why 15% rather than 10%?
A wider trail survives routine corrections and gives back more at the end. Both numbers are one-field edits in DeployQuant, so you can backtest both and compare.
Did trend plus trailing stop beat buy-and-hold on XLK?
No. The rule returned 12.49% a year against 22.07% and ended at $19,653 against $31,425. The maximum drawdown was 32.53% against 32.96%, nearly the same.
Why did it lose money in 2022?
It bought on closes above the 200-day average during bear-market rallies and sold on the stop. Its three trades of 2022 lost 4.28%, 8.27% and 14.42%. The rule fell 31.5% that year against 27.2% for the fund.
How many trades did it make?
Seven closed round trips and 15 fills, with an eighth position open at the end of the test. Four of the seven won, a win rate of 57%. The average hold was 204 days.
What was the best trade?
The best trade returned 53.55% over 556 days, from 2023-01-24 at $65.05 to 2024-08-02 at $99.88. The next best returned 19.21% from 2026-04-09 to 2026-07-28.
Would a tighter stop have done better?
On this fund, yes. A 10% stop returned 14.42% with a 27.96% drawdown and 13 trades. A 20% stop returned 7.55% and a 25% stop 7.15%, with drawdowns of 45.77% and 42.54%.
How does it compare with the plain 200-day filter on XLK?
The 200-day regime filter did better on XLK: 16.81% a year with a 19.72% drawdown, against 12.49% and 32.53% for this template.
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.