Learn › Strategies › SMA-200 Trend + 15% Trailing Stop › XLY

SMA-200 Trend + 15% Trailing Stop on XLY

Consumer Discretionary Select Sector SPDR Fund: consumer discretionary stocks, a cyclical read on the US consumer. Backtest 2021-01-04 to 2026-10-02, $10,000 starting capital, computed by the same engine that runs live DeployQuant strategies.

Result: trend + trailing stop on XLY turned $10,000 into $7,721 (−22.8% total, −4.4% CAGR): it trailed buy-and-hold by 10.7% per year, with a maximum drawdown of 39.7% (buy-and-hold: 39.1%).

The trend with trailing stop template lost 22.79% on XLY. It turned $10,000 into $7,721, a CAGR of -4.4%, while buy-and-hold on XLY, the Consumer Discretionary Select Sector SPDR Fund, gained 41.77% and ended at $14,177 on 6.27% a year. The strategy's maximum drawdown was 39.69% against 39.06% for holding, so the stop did not reduce the worst loss. It ranks twelfth of twelve templates on XLY, and XLY ranks 43rd of 59 funds for the template.

After a close over the 200-day average, the rule buys at the next open using 98% of the sleeve. A trailing stop then rides 15% under the position's high-water mark. There is no target and no signal to exit other than the stop. The sleeve held a position on 67.6% of trading days. Of 7 closed round trips, 3 won, a win rate of 43%. Winners averaged 10.54% and losers averaged -11.55%, and the profit factor was 0.54. The average hold was 178.1 days.

The result comes from two features of the window. The fund had a deep decline from late 2021 to the end of 2022, and a rule that enters above the 200-day average buys into rallies inside that decline. It also crossed its 200-day average 59 times, which is a count that invites repeat entries after each stop. The three losing trades of 2022 and the loss of March to April 2025 account for most of the damage.

Minute data from 2021-01-04 to 2026-10-02 drives the test. It starts with $10,000, uses no margin, and the headline run has no fees or slippage. It covers one sector fund over one window. The results are hypothetical.

−4.4%CAGR
6.3%buy & hold CAGR
−39.7%max drawdown
-0.19Sharpe ratio
7round trips
43%win rate
■ trend + trailing stop   ■ buy & hold, $10,000 invested 2021-01-04

Year by year

Yeartrend + trailing stopbuy & hold
20216.7%28.5%
2022−33.5%−35.7%
202314.5%38.7%
202425.9%26.0%
2025−11.1%7.3%
2026−15.2%−7.2%

Year by year

The strategy returned 6.7% in 2021, -33.5% in 2022, 14.5% in 2023, 25.9% in 2024, -11.1% in 2025 and -15.2% in 2026 so far. XLY returned 28.5%, -35.7%, 38.7%, 26% and 7.3% in 2021 to 2025, and -7.2% so far in 2026. The strategy was ahead by 2.2 points in 2022 and behind by 21.8 in 2021, 24.2 in 2023, 0.1 in 2024, 18.4 in 2025 and 8 in 2026.

2021 was a short year for the rule. Nothing was bought until 2021-10-19, and the sleeve earned 4.82% in October, 1.6% in November and 0.16% in December. The fund returned 28.5% in the year, so the late start meant missing most of that gain.

2022 was the damaging year. The sleeve lost 33.5%, close to the fund's 35.7%, even though the stop was meant to limit declines. The first position, from 2021-10-19 at $91.88, was stopped out on 2022-01-21 at $87.65 for -4.6%. The rule bought again on 2022-02-02 at $89.76 and was stopped on 2022-02-24 at $77.55 for -13.6%. It bought on 2022-03-29 at $92.04 and was stopped on 2022-04-29 at $78.57 for -14.64%. These prices carry split and dividend adjustments, so they read below the quotes of the day. After the April stop the sleeve stayed in cash until February 2023, which kept it out of the rest of the decline.

2023 and 2024 were good years in absolute terms, at 14.5% and 25.9%, and still trailed or matched the fund. The long trade from 2023-11-03 at $77.98 to 2025-03-07 at $100.43 returned 28.79% and carried the sleeve through 2024. 2025 and 2026 gave back part of that. The sleeve lost 11.1% in 2025 against a gain of 7.3% for the fund, and 15.2% in 2026 so far against 7.2%.

Month by month

YearJanFebMarAprMayJunJulAugSepOctNovDec
20210.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%4.8%1.6%0.2%
2022−10.4%−13.3%−3.3%−11.4%0.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%
20230.0%−1.7%3.0%−1.1%2.5%11.9%2.2%−1.7%−5.4%−6.1%5.4%6.0%
2024−4.3%7.7%−0.1%−4.4%0.2%3.8%2.8%−0.2%7.2%−1.7%12.7%1.1%
20253.4%−6.9%−7.8%−10.9%0.3%1.8%1.8%4.6%3.5%0.1%−1.4%1.1%
20261.5%−3.5%−8.9%1.6%2.1%−2.7%−1.0%0.5%−6.3%1.1%––

Month by month

The grid shows how few months produced returns. There was no position from January to September 2021 and from May 2022 to January 2023. The best month was November 2024 at 12.67%, followed by June 2023 at 11.9%. The worst was February 2022 at -13.29%, then April 2022 at -11.43%, April 2025 at -10.87% and January 2022 at -10.45%.

The first four months of 2022 all lost money: January -10.45%, February -13.29%, March -3.26% and April -11.43%. The sleeve held positions in each of them and was stopped out three times. Holding XLY gave a worst month of -11.72% in April 2022 and a best month of 17.99% in July 2022. The strategy was in cash in July 2022 and missed that rally entirely.

That is the cost of the stop-and-wait pattern. After the April 2022 stop the rule stayed in cash through the rally of the summer of 2022. The sleeve re-entered on 2023-02-01 at $71.76, below any of its 2022 entries, and returned 2.53% over 264 days to a sale on 2023-10-23.

The second weak patch was 2025: February -6.9%, March -7.76% and April -10.87%. The sleeve bought on 2025-03-10 at $100.03, three days after being stopped out at $100.43, and sold on 2025-04-07 at $86.68 for -13.34%. The fund's low came the next day, on 2025-04-08.

Calendar averages in XLY are uneven. Its average November was 5.12% and its average July 4.24%, against -1.9% in September and -1.56% in February. With five or six observations a month, they are too few to trade on, and the strategy does not use them.

Every trade

trend + trailing stop on XLY made 7 closed round trips and one position still open at the end of the test, an average hold of 178 days, an average winner of 10.54%, an average loser of −11.55%, a profit factor of 0.54, a longest losing streak of 3. It held a position at the close on 67.6% of trading days.

EntryEntry priceExitExit priceReturnDays held
2021-10-19$91.882022-01-21$87.65−4.6%94
2022-02-02$89.762022-02-24$77.55−13.6%22
2022-03-29$92.042022-04-29$78.57−14.6%31
2023-02-01$71.762023-10-23$73.582.5%264
2023-11-03$77.982025-03-07$100.4328.8%490
2025-03-10$100.032025-04-07$86.68−13.3%28
2025-05-13$105.292026-03-27$105.600.3%318
2026-04-15$115.95open–−5.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 closed trades

Three trades won. The best was 28.79% over 490 days, from 2023-11-03 at $77.98 to 2025-03-07 at $100.43. The next was 2.53% over 264 days from 2023-02-01, and the third was 0.3% over 318 days, from 2025-05-13 at $105.29 to 2026-03-27 at $105.60. Two of the three winners were nearly flat, so one trade produced almost all of the gain.

Four trades lost. The worst was -14.64% over 31 days from 2022-03-29, followed by -13.6% over 22 days from 2022-02-02 and -13.34% over 28 days from 2025-03-10. The first trade lost 4.6% over 94 days. The median return was -4.6% and the median hold was 94 days. The longest hold was 490 days and the shortest was 22 days.

The three biggest losses each sit near the 15% trail. A 15% stop measured from a high-water mark exits about 15% below the best close of the trade, and a position that never rises before it falls exits 15% below its entry. That is the rule working as designed, and it shows the weakness the template describes: every exit gives back 15% from the peak. On a choppy fund the sleeve re-enters above the 200-day average right after the stop and loses again. The sale on 2025-03-07 and re-entry on 2025-03-10 are an example, with a loss of 13.34% in 28 days.

Counted by exit year, 2022 closed 3 trips with no winners, 2023 closed 1 trip that won, 2025 closed 2 with 1 winner, and 2026 closed 1 winner. Winners came at most 2 at a time, and losers at most 3. An open position was bought on 2026-04-15 at $115.95 and was down 5.09% at the last close. It is not counted among the 7.

The average win of 10.54% against an average loss of -11.55% and a 43% win rate gives a profit factor of 0.54. A trend rule with a wide stop needs its winners to be much larger than its losers, and here the single large winner was not large enough to offset the four losses.

The 318-day position and the open trade, month by month

The entry on 2025-05-13 at 105.29 closed on 2026-03-27 at 105.604 for 0.3%, which makes it a win in the trade list. The monthly table shows what happened in between. The sleeve made 0.31% in May, 1.81% in June, 1.84% in July, 4.57% in August, 3.47% in September and 0.14% in October 2025. November lost 1.4% and December made 1.14%. January 2026 made 1.46%, February lost 3.48% and March lost 8.87%, which erased the earlier gains before the exit. The stop is measured from the high-water mark, so the exit price of 105.604 is a long way below the peak of the position.

The long 2023 trade shows a milder version. The entry on 2023-02-01 at 71.76 made 11.9% in June 2023 and 2.24% in July, then lost 1.69% in August, 5.41% in September and 6.12% in October. It closed on 2023-10-23 at 73.576 for 2.53% after 264 days.

The 28.79% trade that followed started on 2023-11-03 at 77.98. November 2023 gained 5.41% and December 6.02%. January 2024 lost 4.35% and February gained 7.72%. The sleeve made 7.2% in September 2024 and 12.67% in November 2024, the best month of the test. February and March 2025 then lost 6.9% and 7.76% before the sale on 2025-03-07 at 100.4275.

The open trade began on 2026-04-15 at 115.95, the highest entry price in the record. April 2026 made 1.56% and May 2.13%, June lost 2.73%, July lost 1%, August made 0.46% and September lost 6.25%. At the last close the position was down 5.09% and the stop had not been hit.

Largest drawdowns

PeakLow pointDepthDays to lowRecoveredDays to recover
2021-11-192023-03-10−39.7%476not yet–
2021-11-052021-11-11−3.8%62021-11-198
2021-11-012021-11-02−0.7%12021-11-031

Buy-and-hold's deepest drawdown ran from 2021-11-19 to 2022-12-28 and reached −39.1%.

Drawdowns

The strategy's deepest drawdown was 39.69%, from a peak on 2021-11-19 to a low on 2023-03-10, 476 days later. No recovery had come by the last day of data. The next two were small: 3.76% from 2021-11-05 to 2021-11-11, recovered on 2021-11-19, and 0.66% in the first days of November 2021.

Buy-and-hold had a 39.06% drawdown from the same peak date, 2021-11-19, to a low on 2022-12-28, which recovered on 2024-11-06 after 679 days. Its second was 25.64%, from 2024-12-17 to 2025-04-08, recovered on 2025-09-12. Its third was 14.79%, from 2026-01-12 to 2026-03-30, still open at the end.

The stop did nothing for the deepest drawdown. The strategy's was 0.63 points deeper than the fund's. The sleeve entered in October 2021, took the fund's decline from the 2021-11-19 peak into early 2022, then lost again on two re-entries before the fund bottomed. The sleeve's low came on 2023-03-10, after it had bought again in February 2023, so its trough lies later than the fund's, which was 2022-12-28.

A 15% trailing stop turns a deep decline into a series of 15% losses. It protects against a loss of 40% only if the stop executes once and the rule stays out. After each stop, the 200-day condition brought the sleeve back in while the fund was still inside a larger decline. The sleeve never recovered the peak of 2021-11-19.

In 2025 the sleeve's loss came from one trade, -13.34% from 2025-03-10 to 2025-04-07, a day before the fund's low on 2025-04-08. The sleeve bought again on 2025-05-13.

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)−4.4%−39.7%$7,721-0.19
5 basis points−4.5%−39.8%$7,687-0.20
10 basis points−4.7%−40.0%$7,610-0.21

Costs

The strategy made 15 fills, so costs had little to work on. Charging 5 basis points of slippage on each fill moved the CAGR from -4.4% to -4.48%, lifted the maximum drawdown to 39.81% and cut the final value to $7,687. With 10 basis points the CAGR was -4.65%, the drawdown 40.05% and the final value $7,610. The cost runs made a negative result slightly worse.

On an average day $892,144,651 of XLY changed hands, and the median minute had 15,102 shares. A $10,000 sleeve fills without trouble in the backtest. The loss comes from the rule, not from execution.

Changing the parameters

VersionCAGRMax drawdownRound tripsWin rateFinal value
Published rules−4.4%−39.7%743%$7,721
10% trailing stop−2.6%−37.8%1436%$8,582
20% trailing stop1.0%−36.6%333%$10,585
25% trailing stop1.1%−28.1%250%$10,644

Wider and narrower stops

Three variants change the width of the stop. A 10% stop returned -2.63% with a 37.81% drawdown, 14 trades and 5 wins, ending at $8,582. A 20% stop returned 1.0% with 36.65%, 3 trades and 1 win, ending at $10,585. A 25% stop returned 1.09% with 28.14%, 2 trades and 1 win, ending at $10,644. The published 15% stop returned -4.4%.

The two wider stops were the only ones that made money, and they did so by trading much less. The 25% stop made two trades in the window and had the shallowest drawdown at 28.14%. A narrower stop traded more, with 14 trades at 10%, and lost less than the published stop. The 15% stop sits between them and has the worst CAGR of the four.

The ordering is not smooth. The 10% stop lost less than the 15% stop, and the 20% and 25% stops made money, so the published width fell at the worst point in the range. That says something about the sample. With 2 to 14 trades each, the differences between settings reflect when a few stops happened to trigger, and not a stable relationship between stop width and result. The table does not support choosing a setting.

How XLY behaved

MeasureXLY
Data in this test2021-01-04 to 2026-10-02 (1444 sessions)
Total return, buy and hold44.7%
Annualized volatility23.3%
Deepest drawdown−39.7% (2021-11-19 to 2022-12-28)
Up days53.0%
Average daily range1.68%
Average overnight gap0.63%
Correlation to SPY0.87
Correlation to QQQ0.86
Correlation to TLT0.11
Sessions above the 200-day average65.1%
Crossings of the 200-day average59
Falls of 10% or more from a 20-day high24

How XLY behaved

Over the window the fund gained 44.67%, a CAGR of 6.64%, at annualized volatility of 23.32%. XLY returned 29.05% in 2021, -36.28% in 2022, 39.68% in 2023, 26.51% in 2024, 7.36% in 2025 and -7.26% in 2026 to date. Against SPY the fund showed a beta of 1.24 and a correlation of 0.87. Its deepest drawdown was 39.67% from 2021-11-19 to 2022-12-28, with a recovery on 2024-11-06 and a longest underwater stretch of 743 sessions.

XLY went through its 200-day average 59 times and closed above it on 65.06% of sessions. The crossing count matters for this template. Each crossing is a potential entry, and a trailing stop that exits and then waits for the next close above the average re-enters often. There were 24 episodes of a 10% drop from a 20-day high, covering 98 days.

Daily moves were large and symmetrical. Up days averaged 1.06% and down days -1.13%, and 53.01% of days finished up. The worst days were -6.54% on 2022-05-18 and -5.97% on 2025-04-03, and the best were 10.79% on 2025-04-09 and 7.27% on 2022-11-10. The sleeve was in cash for the best day of 2022, in the stretch after the April stop, and in cash on the best day of 2025, after the stop on 2025-04-07.

RSI statistics were weak for dip-buying on this fund. There were 27 sessions with RSI(14) under 30. The median 20-day return after them was -0.78%, while the baseline was 0.77%. RSI(2) below 10 on 152 sessions was followed by a median 5-day return of 0.74% against 0.22%, so the shorter signal worked here.

Among the sector funds the same template returned 19.81% on SOXX with 14 round trips, 12.49% on XLK with 7, 8.57% on VOX with 3, 2.62% on XLF with 4 and 1.82% on XLP with 2. XLY at -4.4% was last. The category median stood at 8.57%, against 2.61% for all 59 funds.

Overnight returns, weekdays and the trail variants in XLY

XLY earned 31.78% in log terms overnight and 3.65% during the session, so overnight moves made up 89.7% of its return and intraday moves 10.3%. The average overnight gap was 0.63% and the average intraday range was 1.68%. The rule buys at the open, so it takes the gap on entry and then holds through the session, where the fund added little.

Weekday averages were Monday 0.13%, Friday 0.08%, Wednesday 0.05%, Tuesday 0.01% and Thursday -0.08%. These are small next to the average down day of -1.13%.

The stop width changed the result more than the entry did. A 10% trail made 14 trades with 5 wins and a CAGR of -2.63%. A 20% trail made 3 trades with 1 win and a CAGR of 1%, and a 25% trail made 2 trades with 1 win, a CAGR of 1.09% and a maximum drawdown of 28.14%. All three finished above the 15% default's -4.4%, and the two wider stops were the only settings with a positive CAGR. Buy-and-hold made 6.27%, so none of the trail variants reached it.

The rules

Enter when price is above the 200-day average; exit only when a 15% trailing stop is hit.

  1. WHEN the market opens · IF not invested AND yesterday's close > SMA(200) · THEN buy with 98% of the sleeve
  2. 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.

Where the template sat among the others on XLY

On XLY the weekly 7% target came first at 10.19% with a 24.73% drawdown. RSI(2) snapback followed at 8.2% with 16.62%. RSI mean reversion returned 7% with 20.65%, the dip buyer 4.01% and momentum breakout 3.83% with 18.35%. The monthly cycle returned 3.67% with a 43.81% drawdown, EMA 12/26 trend 2.36% and the golden cross 1.35%.

The SMA 10/50 trend returned 0.35%, the 200-day regime filter -2.16% and 3-month momentum -3.94%. The trailing-stop template came last at -4.4% with the deepest drawdown among the trend rules, 39.69%.

The mean-reversion and weekly rules did best on XLY and the trend rules did worst. That fits a fund that had a deep decline and several sharp rebounds, with 59 crossings of the 200-day line. Rules that hold for months and exit slowly were hurt by the whipsaw, and rules that trade within days were not. The template's own description says the 15% trail is wide enough to survive normal corrections. In this window the fund fell 39.67% in one decline and 25.64% in another.

The result is one fund and one window with 7 closed trades. It says the template lost money on XLY here and says little about its behaviour on funds with steadier trends.

Run trend + trailing stop on XLY 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 trend + trailing stop beat buy-and-hold on XLY?

Over 2021-01-04 to 2026-10-02, trend + trailing stop on XLY returned −4.4% annualized vs 6.3% for buy-and-hold: it trailed buy-and-hold by 10.7% per year, with a maximum drawdown of 39.7% (buy-and-hold: 39.1%).

How many trades did it make?

7 completed round trips over 5.7 years (15 fills), with 43% 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 with a trailing stop beat buy-and-hold on XLY?

No. It returned -4.4% a year against 6.27% for buy-and-hold, ending at $7,721 against $14,177. Its maximum drawdown was 39.69% against 39.06%. It beat the fund only in 2022.

How many trades did the rule make on XLY?

There were 7 closed round trips and 15 fills, plus an open position from 2026-04-15. Three won, a win rate of 43%. The sleeve was invested on 67.6% of days, with an average hold of 178.1 days.

What was the best trade?

A 28.79% gain over 490 days, from 2023-11-03 to 2025-03-07. The other two winners returned 2.53% and 0.3%. The worst trade lost 14.64% over 31 days from 2022-03-29.

Why did the trailing stop not protect the sleeve in 2022?

The sleeve bought three times in 2022 and was stopped out each time, for -4.6%, -13.6% and -14.64%. Each re-entry came after the price closed above its 200-day average inside a larger decline. The sleeve lost 33.5% against 35.7% for the fund.

What happens with a wider or narrower stop?

A 10% stop returned -2.63%, a 20% stop returned 1.0% and a 25% stop returned 1.09%, against -4.4% for the published 15%. The wider stops made 3 and 2 trades. Each result rests on very few trades.

Do trading costs matter here?

Little. The headline run ended at $7,721. Adding 5 basis points per fill gave $7,687, and 10 basis points gave $7,610. The strategy made 15 fills.

Related

SMA-200 Trend + 15% Trailing Stop on all 59 ETFsfull results table All strategies on XLY12 templates compared RSI(14) Mean Reversion on XLYsame ETF, different rulesRSI(2) Dip Snapback on XLYsame 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.