EMA 12/26 Trend on XLF
Financial Select Sector SPDR Fund: S&P 500 banks, insurers and asset managers. Backtest 2021-01-04 to 2026-10-02, $10,000 starting capital, computed by the same engine that runs live DeployQuant strategies.
The EMA 12/26 trend rule turned $10,000 into $13,697 on XLF, the Financial Select Sector SPDR Fund, between 2021-01-04 and 2026-10-02. That is a CAGR of 5.63% and a total return of 36.97%. Buying XLF on day one and holding it ended at $19,742, a CAGR of 12.58%. The rule trailed the fund in five of the six calendar years and led only in 2026, the partial year.
The rule is a long/flat switch. At the open it buys with 98% of the sleeve when the 12-day exponential average is above the 26-day, and it sells the whole position at the open when the 12-day drops below the 26-day. Over the window it made 25 round trips and 50 fills. Fourteen of the round trips won, a win rate of 56%. Winners averaged 4.85% and losers averaged -2.86%, which gives a profit factor of 2.12. The sleeve was invested 62.5% of the time.
The profit factor looks healthy and the CAGR does not, and the gap comes from the fund's path. XLF rose strongly in 2021 and 2024, and the rule was in cash for parts of both. The maximum drawdown was 23.98%, close to the 25.47% the held fund suffered. The rule gave up return and kept nearly the same worst loss. That is the central result of this page.
On this fund the rule ranks seventh of the 12 templates, behind RSI mean reversion at 11.82% and monthly cycle at 11.63%. Among the 59 funds tested with this rule, XLF is 24th. The rest of the analysis walks through the years, the trades, the drawdowns, the cost runs and the parameter variants, and explains why a trend rule found a financial-sector fund hard.
Year by year
| Year | EMA 12/26 trend | buy & hold |
|---|---|---|
| 2021 | 12.4% | 35.8% |
| 2022 | −12.8% | −10.4% |
| 2023 | 6.7% | 11.9% |
| 2024 | 18.1% | 29.9% |
| 2025 | 2.0% | 14.7% |
| 2026 | 8.7% | −1.1% |
How each calendar year played out
2021 was the best year for the rule at 12.4%, and the held fund made 35.8%. The first position opened on 2021-02-10 at an adjusted 28.52 and closed on 2021-06-21 at 32.38, a gain of 13.53% over 131 days. That one trade produced most of the year. The rule then sat out the June drop and re-entered on 2021-08-04, but two small trades in the autumn returned 0.09% and -0.87%. The fund finished the year far ahead of the rule because the rule was out of the market for a large part of the second half and missed rebounds that began before the averages crossed.
2022 returned -12.8% for the rule against -10.4% for holding. It was also the year with the most trades, six round trips with two winners. The fund's calendar-year decline came from a peak on 2022-01-12 to a trough on 2022-10-12. A trend switch is supposed to step aside in a decline like that. Here it kept buying into short rallies and selling a few weeks later. The 2022-02-08 entry at 37.37 closed on 2022-02-24 at 34.10, a loss of 8.75%, the worst trade of the whole test. February 2022 was the worst month of the rule at -8.57%.
2023 returned 6.7% against 11.9% for holding. Four round trips closed in the year and only one won. The winning trade ran from 2023-06-07 to 2023-08-21 for 3.42%. The losing ones were short: 14 days from 2023-04-20, 12 days from 2023-09-13. The November entry on 2023-11-09 is the one that mattered, and it paid in 2024.
2024 returned 18.1% against 29.9% for holding. Four of five round trips won, the best of any year, and the trade from 2023-11-09 to 2024-04-17 gained 18.76% over 160 days, the best trade of the test. A second long trade ran from 2024-08-15 to 2024-12-19 for 10.86%. November 2024 was the best month at 10.18%. The held fund still did better because XLF kept rising in the gaps between the rule's positions, in particular late June and early July when the rule closed one trade on 2024-06-28 and reopened on 2024-07-02.
2025 returned 2% against 14.7% for holding, the widest shortfall in absolute terms after 2021. Four round trips closed, two of them winners, and the largest win was 4.54% from 2025-05-02 to 2025-08-08. The rule was in cash through the April 2025 drop, so April shows 0% for the rule. The held fund had a drawdown of 15.33% from 2025-02-18 to 2025-04-08, and the rule sidestepped it. The price paid was the early-2025 loss of 2.52% on the trade from 2025-01-21 to 2025-03-07 and a gap before the next entry on 2025-05-02, by which point the fund had already recovered a good part of its fall.
2026 is a partial year through 2026-10-02. The rule returned 8.7% and holding returned -1.1%, so this is the one year the rule led. Three round trips closed and all three won, including 8.61% from 2026-06-05 to 2026-09-16. The fund fell 14.65% from 2026-01-06 to 2026-03-27 and the rule was flat for February and March. A single partial year with three trades is a small sample, and it does not change the five-year result.
Month by month
| Year | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2021 | 0.0% | 2.5% | 5.8% | 6.4% | 4.7% | −6.3% | 0.0% | 4.8% | −7.5% | 7.1% | −4.4% | 0.0% |
| 2022 | −2.9% | −8.6% | −1.6% | −2.1% | 0.0% | 0.0% | 2.7% | −2.0% | −0.1% | 2.2% | 6.8% | −7.1% |
| 2023 | 2.9% | −2.3% | −0.6% | −0.3% | −4.3% | 2.4% | 4.7% | −3.6% | −3.2% | 0.0% | 6.0% | 5.4% |
| 2024 | 2.9% | 4.0% | 4.8% | −5.4% | 1.1% | −1.9% | 6.2% | 0.1% | −0.5% | 2.6% | 10.2% | −6.0% |
| 2025 | 2.0% | 1.4% | −5.7% | 0.0% | 2.6% | 3.1% | 0.0% | 1.1% | 0.1% | −2.3% | −2.2% | 2.2% |
| 2026 | −1.8% | 0.0% | 0.0% | 3.2% | −1.1% | 2.6% | 6.0% | 1.3% | −1.6% | 0.0% | – | – |
What the month-by-month figures show
The monthly column has a lot of zeros: 2021-01, 2021-07, 2021-12, 2022-05, 2022-06, 2023-10, 2025-04, 2026-02, 2026-03 and 2026-10 are all months with no position held. Those months are the rule working as designed, since it sold ahead of or during weakness, but the held fund's two worst months, June 2022 at -10.64% and the early-2025 drop, do line up with zeros in the rule's column. Holding lost 10.64% in 2022-06 and the rule lost nothing.
The rule's losses are spread across many mid-sized months instead of one large one. 2021-09 lost 7.54%, 2022-12 lost 7.11%, 2021-06 lost 6.25% and 2024-12 lost 6.05%. Each of these months followed a gain, which is the usual whipsaw pattern: the average signals a trend after it has run, and the position takes the reversal. The 2022-12 loss came right after 2022-11, which gained 6.82%, and it shows how a short rally in a bear market can lift the 12-day average above the 26-day just before the fund rolls over.
On the other side, 2024-11 gained 10.18% and 2023-12 gained 5.38% after 6.01% in 2023-11. When the averages are right, the position is full for the whole run, and that is where the 18.76% and 10.86% trades came from. The months of 2021-03, 2021-04 and 2021-05 (5.75%, 6.36% and 4.73%) belong to the first long trade.
The fund itself has seasonal averages in the facts: November averaged 4.85% and September averaged -3.37% over the window. Each calendar month appears five or six times, so these averages carry little weight and the rule does not use the calendar.
Every trade
EMA 12/26 trend on XLF made 25 closed round trips, an average hold of 53 days, an average winner of 4.85%, an average loser of −2.86%, a profit factor of 2.12, a longest losing streak of 4. It held a position at the close on 62.5% of trading days.
| Entry | Entry price | Exit | Exit price | Return | Days held |
|---|---|---|---|---|---|
| 2021-02-10 | $28.52 | 2021-06-21 | $32.38 | 13.5% | 131 |
| 2021-08-04 | $33.44 | 2021-09-20 | $33.47 | 0.1% | 47 |
| 2021-09-28 | $35.59 | 2021-11-30 | $35.28 | −0.9% | 63 |
| 2021-12-31 | $36.01 | 2022-01-25 | $34.95 | −2.9% | 25 |
| 2022-02-08 | $37.37 | 2022-02-24 | $34.10 | −8.8% | 16 |
| 2022-03-24 | $36.06 | 2022-04-07 | $34.72 | −3.7% | 14 |
| 2022-07-26 | $30.54 | 2022-09-02 | $31.18 | 2.1% | 38 |
| 2022-09-13 | $31.59 | 2022-09-14 | $31.12 | −1.5% | 1 |
| 2022-10-26 | $31.07 | 2022-12-19 | $31.51 | 1.4% | 54 |
| 2023-01-09 | $33.42 | 2023-03-01 | $33.39 | −0.1% | 51 |
| 2023-04-20 | $31.47 | 2023-05-04 | $30.03 | −4.6% | 14 |
| 2023-06-07 | $31.28 | 2023-08-21 | $32.35 | 3.4% | 75 |
| 2023-09-13 | $33.12 | 2023-09-25 | $32.05 | −3.2% | 12 |
| 2023-11-09 | $32.25 | 2024-04-17 | $38.30 | 18.8% | 160 |
| 2024-05-08 | $39.66 | 2024-06-12 | $39.76 | 0.3% | 35 |
| 2024-06-25 | $40.09 | 2024-06-28 | $39.65 | −1.1% | 3 |
| 2024-07-02 | $39.77 | 2024-08-08 | $40.41 | 1.6% | 37 |
| 2024-08-15 | $42.16 | 2024-12-19 | $46.74 | 10.9% | 126 |
| 2025-01-21 | $49.13 | 2025-03-07 | $47.89 | −2.5% | 45 |
| 2025-05-02 | $48.47 | 2025-08-08 | $50.67 | 4.5% | 98 |
| 2025-08-14 | $51.69 | 2025-10-13 | $51.75 | 0.1% | 60 |
| 2025-11-13 | $52.75 | 2025-11-17 | $51.58 | −2.2% | 4 |
| 2025-12-04 | $52.89 | 2026-01-22 | $53.12 | 0.4% | 49 |
| 2026-04-13 | $50.16 | 2026-06-04 | $51.25 | 2.2% | 52 |
| 2026-06-05 | $52.05 | 2026-09-16 | $56.53 | 8.6% | 103 |
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.
Reading the 25 round trips
The median round trip returned 0.12% and the median hold was 47 days. Average holds were longer at 52.5 days because of a few long trades. The longest was 160 days and the shortest was a single day: 2022-09-13 to 2022-09-14, which lost 1.49%. Most of the profit comes from the five trades that returned 18.76%, 13.53%, 10.86%, 8.61% and 4.54%. The other 20 are small. Eleven of them lost money, and the five worst were -8.75%, -4.58%, -3.72%, -3.23% and -2.94%.
The longest winning streak was 3 trades and the longest losing streak was 4. The 2022 losses cluster: 2021-12-31 to 2022-01-25 lost 2.94%, then 2022-02-08 to 2022-02-24 lost 8.75%, then 2022-03-24 to 2022-04-07 lost 3.72%. That is three consecutive entries during the first leg of the fund's decline from 2022-01-12. The rule entered after each small rally and exited after each pullback.
The profit factor of 2.12 comes from asymmetry: average win 4.85% against average loss -2.86%. A few big winners paid for many small losers. This shape matters because a profit factor above 2 is easy to read as an edge. The CAGR of 5.63% is the more complete summary, since it also counts the time the money was idle.
The exposure figure shows the cost of that idleness. The sleeve held XLF for 62.5% of the window. The fund returned 12.58% a year when held throughout. The rule caught a share of the gains smaller than its share of the time in the market, because many of the best days came right after the rule had exited. The five best days for XLF in the facts are 2025-04-09 at 7.59%, 2024-11-06 at 6.09%, 2022-11-10 at 5.11%, 2021-01-06 at 4.38% and 2022-10-13 at 4.17%. The rule was flat on 2025-04-09. It held the fund through 2024-11-06 and 2022-11-10, since entries were open on both dates.
Largest drawdowns
| Peak | Low point | Depth | Days to low | Recovered | Days to recover |
|---|---|---|---|---|---|
| 2021-06-04 | 2023-06-26 | −24.0% | 752 | 2024-11-06 | 499 |
| 2024-11-29 | 2025-05-06 | −9.1% | 158 | 2026-07-01 | 421 |
| 2021-03-12 | 2021-03-23 | −4.2% | 11 | 2021-04-05 | 13 |
Buy-and-hold's deepest drawdown ran from 2022-01-12 to 2022-10-12 and reached −25.5%.
What the drawdowns looked like
The deepest drawdown was 23.98% and it was long. The peak was 2021-06-04, the trough was 2023-06-26 and the recovery came on 2024-11-06. That is 752 days down and 499 days back. Holding XLF had a single large drawdown of 25.47% from 2022-01-12 to 2022-10-12 and a recovery on 2024-02-22.
Two things stand out. The rule's drawdown began in June 2021, before the fund's own peak in January 2022, because the rule lost money on the trades after the June 2021 exit while the fund kept climbing. Then the rule's trough came in June 2023, long after the fund's trough in October 2022. The sequence of small losses across 2022 and 2023 kept the account in a hole while the fund recovered.
The second drawdown was 9.13%, from 2024-11-29 to 2025-05-06, with recovery on 2026-07-01. That took 158 days down and 421 days back. It follows the 2024-12 loss of 6.05% and the early-2025 loss of 2.52%. The third was 4.2% in March 2021, a short episode of 11 days down and 13 days back.
Compared with holding, the rule's max drawdown was 1.49 points shallower. The held fund also had a drawdown of 15.33% in early 2025 and 14.65% in early 2026, both of which the rule avoided or cut. The rule's drawdowns are fewer but longer. For a reader judging risk, the figure to look at is time under water: two multi-year episodes for the rule against one for the fund, followed by quicker recoveries for the fund.
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) | 5.6% | −24.0% | $13,697 | 0.52 |
| 5 basis points | 5.2% | −24.9% | $13,369 | 0.48 |
| 10 basis points | 4.8% | −25.9% | $13,056 | 0.45 |
What fees and slippage did to the result
The headline run has no costs. Adding 5 basis points per trade cut the CAGR to 5.19% and the end equity to $13,369, and pushed the max drawdown to 24.94%. Adding 10 basis points cut the CAGR to 4.75%, the end equity to $13,056 and raised the drawdown to 25.88%. The Sharpe ratio moved from 0.52 to 0.484 and then 0.449.
Fifty fills over 5.74 years is a modest rate, and the cost drag is correspondingly mild. Each added step of 5 basis points lowers the CAGR by a few tenths of a point. XLF trades about $1,682,204,673 a day on average, so a $10,000 sleeve is tiny next to that volume and the cost runs read as a stand-in for commissions and spread. The test does not model taxes, and it does not model short-term gain treatment of 25 round trips, so the after-tax figure would be lower than any of these. Check with a tax professional or broker for how that applies to you.
Changing the parameters
| Version | CAGR | Max drawdown | Round trips | Win rate | Final value |
|---|---|---|---|---|---|
| Published rules | 5.6% | −24.0% | 25 | 56% | $13,697 |
| EMA 8/21 | 7.7% | −22.4% | 31 | 55% | $15,342 |
| EMA 20/50 | 6.3% | −21.7% | 12 | 50% | $14,239 |
| EMA 12/50 | 3.9% | −26.0% | 17 | 41% | $12,438 |
What the other EMA pairs did
Two of the three variants beat the standard pair on CAGR. EMA 8/21 returned 7.74% with a 22.39% drawdown and 31 trades, 17 of them winners, ending at $15,342. EMA 20/50 returned 6.35% with a 21.71% drawdown and only 12 trades, ending at $14,239. EMA 12/50 returned 3.87% with a 26.03% drawdown, 17 trades and 7 winners, ending at $12,438. The standard 12/26 pair returned 5.63%.
The ordering is not smooth. A faster pair did better, a slower pair did better, and a mixed pair did worse. That pattern is typical of a noisy result on one fund and one window: the parameters do not map to the outcome in a straight line, which means no single pair is established as better here. The 20/50 variant shows the slower rule: fewer trades, a shallower drawdown of 21.71%, and a higher CAGR, which suggests the rule gained from avoiding the 2022 whipsaws. The 8/21 variant shows the opposite, 31 trades and the best return of the four, which suggests the faster signals caught more of the rebounds.
Every one of the four runs trailed holding XLF at 12.58%. Tuning the pair narrowed the gap but did not close it. A reader should treat the 7.74% figure as one draw from a set of four, picked after the fact, and not as a better setting.
How XLF behaved
| Measure | XLF |
|---|---|
| Data in this test | 2021-01-04 to 2026-10-02 (1444 sessions) |
| Total return, buy and hold | 102.9% |
| Annualized volatility | 18.4% |
| Deepest drawdown | −25.9% (2022-01-12 to 2022-10-12) |
| Up days | 52.9% |
| Average daily range | 1.40% |
| Average overnight gap | 0.49% |
| Correlation to SPY | 0.77 |
| Correlation to QQQ | 0.59 |
| Correlation to TLT | -0.05 |
| Sessions above the 200-day average | 71.2% |
| Crossings of the 200-day average | 38 |
| Falls of 10% or more from a 20-day high | 10 |
How XLF behaved over the window
XLF returned 102.88% over 1,444 sessions, a CAGR of 13.11% in the fund's own profile, with annualized volatility of 18.43%. Its maximum drawdown was 25.87%, from 2022-01-12 to 2022-10-12, and the longest underwater stretch was 528 sessions. It spent 71.16% of sessions above its 200-day average but crossed that average 38 times. That many crossings explain the whipsaws. Trend rules do well on funds that stay on one side of the average for long stretches, and XLF crossed back and forth.
The lag-1 autocorrelation of daily returns was 0.02, close to zero. There was almost no day-to-day momentum in the fund, and that is a poor input for a rule that assumes yesterday's direction continues. The fund rose on 52.88% of days, with the average up day at 0.86% and the average down day at -0.86%, which is symmetrical. Its overnight gaps contributed 62.56% of the return and its intraday moves 37.44%. The rule buys and sells at the open, so it receives the overnight gap on days when it holds the position from the prior close and pays for it when it enters after a gap up.
The fund's beta to SPY was 0.87 and its correlation to SPY was 0.77, so it moves with the broad market but not tightly. The same rule fits a broad index better, since a broad index spends more of the window in a steady uptrend. Among the six sector funds in the category, XLF's rule return was fourth: SOXX at 17.96% led, then XLK at 9.84% and VOX at 5.8%, with XLY at 2.36% and XLP at 1.19% behind. The category median for this rule was 5.8%, and the median over all 59 funds was 2.76%. XLF sat close to the category median and above the all-fund median.
The fund's correlation list shows FAS at 1, VTV and VOOV at 0.89. FAS is the leveraged financial fund, so the near-perfect correlation reflects the same holdings. The inverse funds SH, SDS and SPDN correlate with it at -0.78, -0.77 and -0.77 with it.
The rules
Hold while the 12-day exponential average is above the 26-day, the core of the MACD used as a position switch.
- WHEN the market opens · IF not invested AND EMA(12) > EMA(26) · THEN buy with 98% of the sleeve
- WHEN the market opens · IF invested AND EMA(12) < EMA(26) · THEN sell the whole position
The 12/26 exponential moving average pair is the core of the MACD indicator. Exponential averages weight recent days more than simple averages, so this crossover reacts faster than an SMA pair of the same length. Used as a long/flat switch, it gives you a position you can hold and measure.
Good for: traders who like MACD logic but want it expressed as a simple, testable long/flat rule.
Watch out: faster reaction means more trades and more whipsaws than a 50/200 cross; check the trade count on each backtest page.
How the crossover interacts with this fund
The exponential average gives more weight to recent closes, so a 12/26 crossover reacts within days of a turn. On a fund with a lag-1 autocorrelation of 0.02 and 38 crossings of the 200-day average, a quick reaction cuts both ways. It exits early in real declines, as in the 2025 drop, and it exits early in pullbacks that reverse, as in the 2024-06-28 exit that was followed by a re-entry four days later.
The 2022 sequence shows the failure mode most clearly. XLF's decline of 25.87% unfolded as a series of bounces, and each bounce was long enough to pull the 12-day above the 26-day. The rule entered after the bounce had run, then sold after the next leg down. Six round trips in 2022 produced two winners and a -12.8% year.
The rule's best results came in trends that lasted months. The entries on 2023-11-09, 2024-08-15, 2021-02-10 and 2026-06-05 all ran for 100 days or more and returned between 8.61% and 18.76%. The test supports a narrow statement: on XLF, this rule paid when the fund trended for a few months, and it lost small amounts repeatedly when the fund chopped. The results come from one window of 5.74 years and one fund, with a headline run that has no fees.
Where the test stops
The window is 5.74 years and contains one bear market. The numbers reflect that window and may look different in another one. The headline run charges no fees or slippage, the cost runs add 5 and 10 basis points, and the rule decides once a day at the open. Orders fill on minute bars, no margin is used, and prices in the trade list are adjusted for splits and dividends, so they are lower than the quotes printed at the time.
Related pages: the strategy hub for this rule across all 59 funds, the XLF fund page for the fund on its own, and the same fund under weekly profit target, RSI(2) snapback and dip buyer. Other sector funds under the same rule are XLK and SOXX.
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 EMA 12/26 trend beat buy-and-hold on XLF?
Over 2021-01-04 to 2026-10-02, EMA 12/26 trend on XLF returned 5.6% annualized vs 12.6% for buy-and-hold: it trailed buy-and-hold by 7.0% per year, with a maximum drawdown 1.5 points shallower than holding (24.0% vs 25.5%).
How many trades did it make?
25 completed round trips over 5.7 years (50 fills), with 56% of round trips closing profitably.
Is this the same as trading MACD signals?
It uses the MACD's underlying trend component. Classic MACD trades the signal-line crossover of the 12/26 spread. This template trades the spread's sign directly, which is simpler and can be built fully in blocks.
How did the EMA 12/26 trend rule do on XLF?
It turned $10,000 into $13,697 from 2021-01-04 to 2026-10-02, a CAGR of 5.63% with a maximum drawdown of 23.98%. Buy-and-hold on XLF ended at $19,742, a CAGR of 12.58% with a drawdown of 25.47%. The result is one backtest with no fees in the headline run.
How many trades did the rule make on XLF?
It made 25 round trips and 50 fills. Fourteen won, a win rate of 56%, and the average hold was 52.5 days. The longest hold was 160 days and the shortest was one day.
Did the rule reduce the drawdown compared with holding XLF?
Barely. The rule's maximum drawdown was 23.98% and holding's was 25.47%. The rule's longest drawdown ran from 2021-06-04 to a recovery on 2024-11-06, and the rule avoided the 15.33% decline of early 2025 but not the long whipsaw period of 2022 and 2023.
What happens to the result with trading costs?
At 5 basis points per trade the CAGR falls to 5.19% and the end equity to $13,369. At 10 basis points the CAGR is 4.75% and the end equity is $13,056. The costs are small because the rule made only 50 fills.
Does a different EMA pair work better on XLF?
Three variants were tested. EMA 8/21 returned 7.74%, EMA 20/50 returned 6.35% and EMA 12/50 returned 3.87%, against 5.63% for 12/26. None came close to holding XLF at 12.58%, and the order of the results does not follow the speed of the pair.
Which strategy did best on XLF in this test?
[RSI mean reversion](/learn/strategies/rsi-mean-reversion/xlf/) led at 11.82% a year, followed by [monthly cycle](/learn/strategies/monthly-cycle/xlf/) at 11.63%. EMA 12/26 trend ranked seventh of 12 at 5.63%, and the 200-day regime filter ranked last at 2.06%.
Is this a prediction of how the rule will do on XLF?
No. It is a historical simulation over 5.74 years with one bear market. It shows what the rule did on this fund in that window, and the same rule can behave differently in another period.
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.