EMA 12/26 Trend on SOXX
iShares Semiconductor ETF: the semiconductor industry, a high-momentum sector. Backtest 2021-01-04 to 2026-10-02, $10,000 starting capital, computed by the same engine that runs live DeployQuant strategies.
From $10,000 on 2021-01-04, the EMA 12/26 trend rule on SOXX reached $25,811 by 2026-10-02, a 158.11% gain and a CAGR of 17.96%. SOXX is the iShares Semiconductor ETF, and a buy-and-hold account put 98% into the fund on the first open and compounded at 31.11% a year to $47,348. The rule gave up 13.15 points of CAGR a year against holding, and the worst drawdown shrank from 45.06% to 33.96%.
The Sharpe ratio was 0.77 for the rule and 0.92 for holding. Only one calendar year went the rule's way: 2022, a loss of 26.9% where the fund lost 34.5%. The other years went to the fund. The shortfall measured 30.8 points in 2021, 26.4 in 2023, 12.8 in 2024, and 33.8 in 2026 (a partial year ending 2026-10-02). Only 2025 was close, at 39.8% against 40.1%.
This is the usual trade for a trend switch on a fund that rose strongly. The rule sits in cash during declines and during confusing stretches, which shortens drawdowns, and it also sits in cash during the early part of recoveries, which costs return. SOXX recovered from its 2022 low with a long run, so the cost of that lag was large. The rule's exposure was 60.6% of trading days.
Across the 59 funds in the library, the EMA 12/26 trend template had a median CAGR of 2.76%. SOXX at 17.96% is well above that, and it is the fourth best fund for this template. Measured against the other 12 templates run on SOXX, the EMA rule sits seventh by CAGR.
Year by year
| Year | EMA 12/26 trend | buy & hold |
|---|---|---|
| 2021 | 12.8% | 43.6% |
| 2022 | −26.9% | −34.5% |
| 2023 | 38.9% | 65.3% |
| 2024 | 0.0% | 12.8% |
| 2025 | 39.8% | 40.1% |
| 2026 | 61.2% | 95.0% |
Calendar years against holding
The rule returned 12.8% in 2021 against 43.6% for holding. It entered on 2021-02-10 and left on 2021-03-05 for a loss of 6.66%, then spent the spring and summer in three trades that returned 1.0%, 1.2% and 1.3%. The one large gain of the year was the position entered on 2021-10-22 at $149.15 and sold on 2022-01-19 at $166.05, which returned 11.33%. Of the four round trips that closed in 2021, three won.
2022 was the year the rule justified itself, in a limited sense. The fund lost 34.5% and the rule lost 26.9%. It still lost a lot, because the exits came after declines had started and the re-entries came into rallies that failed. Five trades closed that year and only one won. The worst trade of the entire test was on 2022-06-03, an entry at $136.30 that was sold on 2022-06-13 at $121.78, a loss of 10.65% in 10 days. The entry on 2022-03-25 lost 9.54% in 13 days. The rule was flat in February, May, September and October of 2022, and each of those months shows 0.0% in the monthly table.
2023 returned 38.9% against 65.3%. Three trades closed, two of them winners, and the largest was the entry on 2023-11-13 at $160.59, held for 156 days and sold on 2024-04-17 at $213.53 for 32.97%. That trade carried most of the year and part of the next.
2024 ended at 0.0% against 12.8% for the fund. Four trades closed and two won. The winners were the 32.97% position that closed in April, much of it earned in 2023, and a 3.0% gain in July. The losses were 7.6% on the entry of 2024-09-26 and 4.0% on the one-day trade in December. The monthly table shows -7.85% in July, -5.2% in October and -6.75% in December.
2025 returned 39.8%, nearly matching the fund's 40.1%, and that is the smallest gap of the six years. The year held a stretch of four straight losers (entered 2024-12-18, 2024-12-27, 2025-01-07 and 2025-02-19) followed by the largest winner of the test. The entry on 2025-05-07 at $184.82 was sold on 2025-11-20 at $287.56, a gain of 55.59% over 197 days. One winner covered four losers and then some.
2026 returned 61.2% against 95.0%, a partial year. The entry on 2026-04-09 at $371.73 was sold on 2026-07-16 at $541.10 for 45.56%. A new position opened on 2026-09-22 at $556.07 and was still open at the last close with a mark of 5.9%.
Month by month
| Year | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2021 | 0.0% | −1.0% | −2.7% | −0.5% | −0.8% | 5.0% | −1.5% | 2.4% | −4.4% | 2.6% | 11.1% | 2.7% |
| 2022 | −4.7% | 0.0% | −2.7% | −6.8% | 0.0% | −10.4% | 2.1% | −6.3% | 0.0% | 0.0% | 9.9% | −10.1% |
| 2023 | 5.3% | 1.4% | 8.6% | −6.3% | 9.7% | 6.5% | 5.3% | −9.5% | −2.0% | 0.0% | 4.7% | 12.0% |
| 2024 | 1.7% | 10.9% | 3.9% | −4.0% | 6.0% | 5.3% | −7.8% | 0.0% | −3.1% | −5.2% | 0.8% | −6.8% |
| 2025 | −5.4% | −3.5% | 0.0% | 0.0% | 9.6% | 16.4% | 0.5% | 2.1% | 10.6% | 12.8% | −5.8% | −0.6% |
| 2026 | 14.6% | 1.7% | −9.2% | 23.2% | 22.6% | 12.2% | −15.1% | 0.0% | 2.2% | 3.5% | – | – |
Month by month
The monthly table shows the rule's selectivity better than the yearly one. A 0.0% reading marks a month spent entirely in cash, and there are many. Those cluster in 2022 and early 2025. In 2025 the rule was flat in March and April, the months holding the fund's two worst days of that year: -10.11% on 2025-04-03 and -8.34% on 2025-04-10. The fund's single best session of the test, +18.84% on 2025-04-09, landed in the same flat stretch and the rule was not there for it. Holding through April 2025 meant taking both the fall and the rebound. The rule took neither.
The best months for the rule were 2026-04 at 23.22%, 2026-05 at 22.62%, 2025-06 at 16.45%, 2026-01 at 14.62% and 2026-06 at 12.21%. The worst months were 2026-07 at -15.08%, 2022-06 at -10.42%, 2022-12 at -10.12%, 2023-08 at -9.47% and 2026-03 at -9.22%. July 2026 was the rule's worst month, and holding fell 21.13% in it, which means the fund did worse.
The monthly table also shows how often a gain in one month is followed by a loss in the next while the rule is still invested: 2023-04 lost 6.32% after a 8.64% March, and 2023-08 lost 9.47% after a run of gains. A moving-average rule stays in until the cross, so it takes these pullbacks and relies on the larger trends that follow.
Every trade
EMA 12/26 trend on SOXX made 22 closed round trips and one position still open at the end of the test, an average hold of 58 days, an average winner of 16.17%, an average loser of −5.33%, a profit factor of 3.33, a longest losing streak of 5. It held a position at the close on 60.6% of trading days.
| Entry | Entry price | Exit | Exit price | Return | Days held |
|---|---|---|---|---|---|
| 2021-02-10 | $134.30 | 2021-03-05 | $125.35 | −6.7% | 23 |
| 2021-03-30 | $131.63 | 2021-05-05 | $132.99 | 1.0% | 36 |
| 2021-05-28 | $137.47 | 2021-07-21 | $139.13 | 1.2% | 54 |
| 2021-07-22 | $142.01 | 2021-10-01 | $143.92 | 1.3% | 71 |
| 2021-10-22 | $149.15 | 2022-01-19 | $166.05 | 11.3% | 89 |
| 2022-03-25 | $156.44 | 2022-04-07 | $141.52 | −9.5% | 13 |
| 2022-06-03 | $136.30 | 2022-06-13 | $121.78 | −10.7% | 10 |
| 2022-07-22 | $128.74 | 2022-08-30 | $122.90 | −4.5% | 39 |
| 2022-11-10 | $114.33 | 2022-12-23 | $112.88 | −1.3% | 43 |
| 2023-01-12 | $124.52 | 2023-04-24 | $135.66 | 8.9% | 102 |
| 2023-05-18 | $141.39 | 2023-08-14 | $157.84 | 11.6% | 88 |
| 2023-09-06 | $166.70 | 2023-09-11 | $163.17 | −2.1% | 5 |
| 2023-11-13 | $160.59 | 2024-04-17 | $213.53 | 33.0% | 156 |
| 2024-05-10 | $217.51 | 2024-07-25 | $224.01 | 3.0% | 76 |
| 2024-09-26 | $235.65 | 2024-11-01 | $217.75 | −7.6% | 36 |
| 2024-12-18 | $223.10 | 2024-12-19 | $214.10 | −4.0% | 1 |
| 2024-12-27 | $220.48 | 2025-01-02 | $215.71 | −2.2% | 6 |
| 2025-01-07 | $229.50 | 2025-01-30 | $214.80 | −6.4% | 23 |
| 2025-02-19 | $225.43 | 2025-02-27 | $217.27 | −3.6% | 8 |
| 2025-05-07 | $184.82 | 2025-11-20 | $287.56 | 55.6% | 197 |
| 2025-12-03 | $302.45 | 2026-03-09 | $318.53 | 5.3% | 96 |
| 2026-04-09 | $371.73 | 2026-07-16 | $541.10 | 45.6% | 98 |
| 2026-09-22 | $556.07 | open | – | 5.9% | – |
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 trade list
Twenty-two round trips closed and one stayed open. Half of the closed trades, 11, were winners. A winner averaged 16.17% and the average loser returned -5.33%, which gives a profit factor of 3.33. The median trade returned 1.03%, well under the average winner, because a few large wins pull the average up. The best run of consecutive winners was 4, the worst run of losers 5.
Holding periods ran from 1 day to 197 days, with a median of 43 and an average of 57.7. The 1-day trade was the entry on 2024-12-18 at $223.10 that was sold on 2024-12-19 at $214.10 for -4.0%, a reminder that a cross can flip back the next session when the two averages sit close together.
Grouped by exit year, wins were 3 of 4 in 2021, 1 of 5 in 2022, 2 of 3 in 2023, 2 of 4 in 2024, 1 of 4 in 2025 and 2 of 2 in 2026. The weakest hit rates came in 2022 and 2025, and the two years ended differently. 2022 had no large winner. 2025 had the largest winner of the test.
The five best trades returned 55.59%, 45.56%, 32.97%, 11.63% and 11.33%. The five worst returned -10.65%, -9.54%, -7.6%, -6.66% and -6.41%. The three best trades alone span 197, 98 and 156 days. The profile of the rule is clear from these numbers: it takes many small losses and a few long holds, with the three largest gains at 55.59%, 45.56% and 32.97%. Any change in the count of those long holds would change the result a lot, and in a window of 5.7 years there were only three.
Largest drawdowns
| Peak | Low point | Depth | Days to low | Recovered | Days to recover |
|---|---|---|---|---|---|
| 2024-07-10 | 2025-02-25 | −34.0% | 230 | 2025-10-02 | 219 |
| 2021-12-27 | 2023-01-19 | −30.2% | 388 | 2023-12-27 | 342 |
| 2026-06-22 | 2026-07-16 | −17.0% | 24 | not yet | – |
Buy-and-hold's deepest drawdown ran from 2021-12-27 to 2022-10-14 and reached −45.1%.
Depth and length of the declines
The rule's deepest drawdown started at a peak on 2024-07-10 and bottomed on 2025-02-25 at 33.96%, 230 days in. The old peak came back on 2025-10-02, 219 days after that. The second ran from 2021-12-27 to 2023-01-19 at 30.18%. That one took 388 days to reach the low and 342 days to recover, with the peak regained on 2023-12-27. A third opened on 2026-06-22 and stood at 17% on 2026-07-16, still unrecovered when the data ends.
Holding the fund had three deeper drawdowns. The first ran from 2021-12-27 to 2022-10-14 at 45.06% and recovered on 2023-12-13. The second ran from 2024-07-10 to 2025-04-08 at 40.93% and recovered on 2025-09-18. The third, from 2026-06-22, reached 28.99% by 2026-07-29 and had not recovered. The rule and the fund topped out on the same dates in 2021, 2024 and 2026. The rule was long at each top and got out only after prices had slid.
The 2024 to 2025 episode shows what the rule cannot do. Both peaked on 2024-07-10, and the rule's 33.96% decline sat close to the fund's 40.93%, so the exit signal came late. The earlier episode, 2021 to 2023, shows a bigger saving: cash stretches in 2022 held the rule to 30.18% where the fund hit 45.06%.
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) | 18.0% | −34.0% | $25,811 | 0.77 |
| 5 basis points | 17.5% | −34.3% | $25,226 | 0.75 |
| 10 basis points | 17.2% | −34.4% | $24,889 | 0.74 |
Slippage runs
The headline numbers assume fills at the bar price and no fees. Charging 5 basis points per fill pulled CAGR to 17.49% and the final value to $25,226. At 10 basis points it fell to 17.21% and $24,889. The maximum drawdown moved from 33.96% to 34.25% and then 34.35%, and the Sharpe ratio from 0.77 to 0.75 and 0.74. The rule makes 45 fills over the window, so cost has a modest effect: the account kept most of its return at both levels.
Two things keep the cost effect small here. The rule trades rarely, with 45 fills in 5.7 years, and the average winner of 16.17% is large next to a charge of a few basis points on each side. A strategy that traded every few days on a fund like this would lose far more to the same charge. The run uses a flat per-fill charge, so it does not model a wider spread on a fast day such as 2025-04-09, and real fills on a fund that moves 2.58% in an average day could land further from the bar price than 10 basis points.
Changing the parameters
| Version | CAGR | Max drawdown | Round trips | Win rate | Final value |
|---|---|---|---|---|---|
| Published rules | 18.0% | −34.0% | 22 | 50% | $25,811 |
| EMA 8/21 | 18.0% | −34.3% | 37 | 38% | $25,834 |
| EMA 20/50 | 16.1% | −34.1% | 16 | 50% | $23,537 |
| EMA 12/50 | 14.3% | −31.0% | 19 | 47% | $21,482 |
Parameter variants
Three variants were run on the same fund and window. EMA 8/21, a faster pair, returned 17.98% a year and ended at $25,834, almost the same as the published 12/26 result. It took 37 round trips, 14 of them winners (38%), and its worst drawdown was 34.3%. More trades arrived without more return.
EMA 20/50 returned 16.08% with 16 round trips and 8 wins, a 50% win rate, and ended at $23,537. EMA 12/50 holds the fast leg and lengthens the slow leg. It returned 14.25% with 19 round trips and 9 wins, and ended at $21,482. Its drawdown of 31.04% was the shallowest of the four versions.
Slower pairs earned less on this fund, and the faster pair matched the published one. The choice of 12/26 looks stable within this small set, since all four versions finished between $21,482 and $25,834. All four ended well below the $47,348 of holding. This is four versions on one window, so it says little about other periods.
How SOXX behaved
| Measure | SOXX |
|---|---|
| Data in this test | 2021-01-04 to 2026-10-02 (1444 sessions) |
| Total return, buy and hold | 388.4% |
| Annualized volatility | 38.1% |
| Deepest drawdown | −45.8% (2021-12-27 to 2022-10-14) |
| Up days | 53.9% |
| Average daily range | 2.58% |
| Average overnight gap | 1.07% |
| Correlation to SPY | 0.79 |
| Correlation to QQQ | 0.87 |
| Correlation to TLT | 0.05 |
| Sessions above the 200-day average | 70.7% |
| Crossings of the 200-day average | 38 |
| Falls of 10% or more from a 20-day high | 43 |
How SOXX behaved
As a buy-and-hold position SOXX gained 388.35% in the window, with annualized volatility of 38.08%. Its fund-level drawdown peaked at 45.81% (2021-12-27 to 2022-10-14), recovered 2023-12-13, and the longest stretch under water was 493 sessions. Up days made up 53.92% of sessions, and up and down days averaged the same size, 1.78%.
SOXX closed above its 200-day average on 70.68% of sessions and crossed that line 38 times. The 10% drawdown from a 20-day high happened 43 times across 197 days. Its beta was 1.84 against SPY and 1.49 against QQQ, with correlations of 0.79 and 0.87. The correlation to TLT was 0.05. Its closest relatives in the library are SOXL at a correlation of 1.0, XLK and TECL at 0.9.
The overnight gap accounted for 86.53% of the fund's return and the trading session for 13.47%. A rule that sits in cash gives up those gaps as well.
Among sector funds the rule did best on SOXX. XLK returned 9.84%, VOX 5.8%, XLF 5.63%, XLY 2.36% and XLP 1.19%. The library describes SOXX as a high-momentum sector.
Several other templates beat it here. The weekly 7% target reached 30.54% (drawdown 22.76%), the monthly cycle 29.17% and the golden cross 28.24%. The RSI(2) snapback made 17.01%, a little below the EMA rule, and the SMA 10/50 trend made 7.65%. The page of all strategies on SOXX ranks the twelve, and the EMA 12/26 hub has the other 58 funds.
Everything above comes from a single 5.7-year window. Decisions are made once a day, no margin is used, and trade prices carry split and dividend adjustments. The headline run charges nothing for trading. These are hypothetical results for this window only.
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.
The rule and what it asks of a fund
The rule has an entry and an exit. Flat with the 12-day exponential average over the 26-day: buy at the open using 98% of the sleeve. Invested with the 12-day under the 26-day: sell the whole position at the open. The pair is the core of the MACD indicator, used as a long or flat switch. An exponential average gives recent closes more weight, so this pair turns sooner than two simple averages of equal length would.
The template notes expect extra trades and whipsaws compared with a 50/200 cross. SOXX produced 22 completed round trips across 5.7 years, with a 23rd position left open. What stands out is the size of the swings the rule had to sit through. SOXX has an annualized volatility of 38.08% and an average daily range of 2.58%, which are high numbers for a sector fund, and every crossover on it happens inside large moves.
The averages use closes while orders go in at the next open, so a trade can enter after a move is under way and exit after a decline has started. That lag is the price of the rule. It shows in the trade list as winners that capture the middle of a trend and losers that give back part of a gain before the cross.
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 SOXX?
Over 2021-01-04 to 2026-10-02, EMA 12/26 trend on SOXX returned 18.0% annualized vs 31.1% for buy-and-hold: it trailed buy-and-hold by 13.1% per year, with a maximum drawdown 11.1 points shallower than holding (34.0% vs 45.1%).
How many trades did it make?
22 completed round trips over 5.7 years (45 fills), with 50% 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.
Is the EMA 12/26 rule better than holding SOXX?
On return it trailed: 17.96% a year and $25,811 against 31.11% and $47,348 for holding. Its one winning calendar year was 2022. The deepest drawdown was milder at 33.96%, where the fund had 45.06%.
How active was the EMA 12/26 rule on SOXX?
The test closed 22 round trips and ended with one position open. Winners numbered 11, so half. Winners averaged 16.17% and losers averaged -5.33%.
What was the biggest winning trade?
Buying on 2025-05-07 at $184.82 and selling on 2025-11-20 at $287.56 produced 55.59% in 197 days, also the longest hold. Second place was 45.56%, from 2026-04-09 to 2026-07-16.
How much did trading costs reduce the result?
With 5 basis points per fill, CAGR came to 17.49% and the account to $25,226. With 10, it came to 17.21% and $24,889. The cost-free headline run finished at $25,811.
Did a faster or slower EMA pair do better on SOXX?
The faster EMA 8/21 pair returned 17.98%, close to the published 17.96%, with 37 round trips. The slower EMA 20/50 returned 16.08% and EMA 12/50 returned 14.25%. All stayed below buy-and-hold at 31.11%.
Why did the rule do well in 2025 relative to buy-and-hold?
It returned 39.8% against 40.1% because a single trade, entered on 2025-05-07, gained 55.59%. The rule was in cash in March and April 2025, which avoided the fund's worst days and also its best day on 2025-04-09.
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.