Learn › Strategies › EMA 12/26 Trend › IEF

EMA 12/26 Trend on IEF

iShares 7-10 Year Treasury Bond ETF: intermediate Treasuries, a common 60/40 diversifier. Backtest 2021-01-04 to 2026-10-02, $10,000 starting capital, computed by the same engine that runs live DeployQuant strategies.

Result: EMA 12/26 trend on IEF turned $10,000 into $9,778 (−2.2% total, −0.4% CAGR): it beat buy-and-hold by 1.9% per year, with a maximum drawdown 11.1 points shallower than holding (10.6% vs 21.8%).

The EMA 12/26 trend rule on IEF, the iShares 7-10 Year Treasury Bond ETF, turned $10,000 into $9,778.03 between 2021-01-04 and 2026-10-02. That is a CAGR of -0.39% with a maximum drawdown of 10.63% and a Sharpe ratio of -0.06. Buying IEF on day one and holding returned -2.29% a year, ended at $8,755.84 and fell 21.77% at its worst. The rule lost less than the fund, and it still lost money.

The rule is a long/flat switch. Entry needs the 12-day exponential average above the 26-day; the order goes in at the open for 98% of the sleeve. Exit is the reverse cross, and the whole position is sold. Over the window the rule closed 26 round trips, 5 of them profitable, so 19% of trades won. The average winner made 3.35% and the average loser gave up 0.89%, which gives a profit factor of 0.87. The position was in the market 48.5% of the time.

Two things explain most of the result. IEF spent the first three of the six years falling, with a trough on 2023-10-19, and the rule was flat for part of that fall. The same rule then paid for that protection with a long string of small losing entries, ten in a row at the longest. Both effects show up in the year, month and trade tables.

Among the 12 templates tested on IEF, this one ranks 6th by CAGR. Across the 59 funds, IEF ranks 43rd for this strategy. Across all 59 funds the rule's median CAGR is 2.76%, and in the bond category it is 1.02%. IEF came in under both. Everything here comes from 5.74 years of data and a single run on this fund, with fees and slippage left out of the headline numbers. The figures are hypothetical.

−0.4%CAGR
−2.3%buy & hold CAGR
−10.6%max drawdown
-0.06Sharpe ratio
26round trips
19%win rate
■ EMA 12/26 trend   ■ buy & hold, $10,000 invested 2021-01-04

Year by year

YearEMA 12/26 trendbuy & hold
20210.2%−3.3%
2022−5.8%−14.8%
20233.0%3.5%
2024−0.5%−0.6%
20254.2%7.8%
2026−3.0%−4.5%

How each year played out

The yearly table shows the rule against the fund. The rule returned 0.2% in 2021, -5.8% in 2022, 3% in 2023, -0.5% in 2024, 4.2% in 2025 and -3% in 2026 to date. Holding the fund gave -3.3%, -14.8%, 3.5%, -0.6%, 7.8% and -4.5% for those years. Four of the six years went to the rule (2021, 2022, 2024 and 2026 to date). The fund won 2023 and 2025.

2021 was a small positive year for the rule, 0.2%, against -3.3% for the fund. The first three months were flat because the fast average was below the slow one, and the first entry came on 2021-04-23. That trade lasted 7 days and lost 0.61%. The next entry, on 2021-05-05, lost 0.45%. Then the entry on 2021-05-25 held for 107 days and made 2.45%, selling on 2021-09-09 at an adjusted price of 100.23. July 2021 was the best month of the year at 1.94%. The gap to the fund was 3.5 points in the rule's favour, almost all of it from sitting out the first quarter.

2022 produced the largest gap, 9 points, and it came from losing less in a bad year. The rule lost 5.8% while IEF lost 14.8%, and the fund's own calendar-year return was -15.16%. The rule still took five losing trades that year and won none. The entry on 2022-03-07 at 96.87 was sold four days later at 95.14 for a loss of 1.79%. The entry on 2022-07-06 held 48 days and lost 1.9%, the worst trade of the whole test. August 2022 was the rule's worst month at -2.9%. September and October 2022 were flat, with the rule out of the market while buy-and-hold took the fund's worst month, -4.56% in September.

2023 went the other way. The rule made 3% and the fund made 3.5%. It lost on both of its entries in the first half, then sat in cash from June to October. The entry on 2023-11-08 at 82.24 was close to the fund's trough on 2023-10-19, and it held 96 days to a 3.98% gain. December 2023 returned 3.66%, the best month of the test. The rule missed the first leg of the recovery and caught the second.

2024 was close to flat for both, -0.5% for the rule and -0.6% for the fund. The rule made 5.01% on the trade from 2024-05-14 to 2024-10-08, its single best, and lost on the short trades in March and April. 2025 favoured the fund, 7.8% against 4.2%, since the rule was out of the market for stretches of a year in which the fund rose. 2026 to date is negative for both, -3% for the rule and -4.5% for the fund, with five losing trades and no winners.

Month by month

YearJanFebMarAprMayJunJulAugSepOctNovDec
20210.0%0.0%0.0%−0.6%−0.5%1.0%1.9%−0.4%−0.5%0.0%−0.6%−0.1%
2022−1.1%0.0%−1.8%0.0%−0.3%−0.3%1.1%−2.9%0.0%0.0%0.7%−1.4%
20231.0%−2.0%−0.4%0.8%−1.8%0.0%0.0%0.0%0.0%0.0%1.8%3.7%
20240.1%−1.7%−1.6%−1.3%0.0%1.2%2.8%1.3%1.3%−1.8%0.0%−0.7%
2025−0.2%2.7%0.3%1.0%−2.1%0.6%−0.6%1.6%0.7%0.7%1.0%−1.4%
2026−0.6%1.6%−1.7%−0.9%0.0%0.1%−0.8%−0.6%0.0%0.0%––

Months with no position

The month-by-month grid has many zero cells in 2021 to 2023: the first three months of 2021, February and April 2022, September and October 2022, and the long stretch from June to October 2023. Those are months with no position and no return. The rule's defensive years come from these gaps, since a flat month cannot lose.

The losing months cluster in the stretches where the rule was long and the fund drifted down. February and May of 2023 returned -2.03% and -1.8%. February to April 2024 returned -1.68%, -1.65% and -1.29%. Those three months came from two short trades that were sold at a loss and one entry that was already under water. In the other direction, July 2024 returned 2.81% and February 2025 returned 2.72%.

The fund's own calendar-month averages show seasonality in this sample. November averaged 2.24% across 5 observations and September averaged -1.79% across 6. With one observation per year, these averages rest on very few data points. They are a description of this window.

Every trade

EMA 12/26 trend on IEF made 26 closed round trips, an average hold of 39 days, an average winner of 3.35%, an average loser of −0.89%, a profit factor of 0.87, a longest losing streak of 10. It held a position at the close on 48.5% of trading days.

EntryEntry priceExitExit priceReturnDays held
2021-04-23$97.922021-04-30$97.32−0.6%7
2021-05-05$97.602021-05-13$97.16−0.5%8
2021-05-25$97.832021-09-09$100.232.5%107
2021-09-10$100.252021-09-13$100.22−0.0%3
2021-09-15$100.542021-09-20$100.22−0.3%5
2021-11-10$99.172021-11-12$98.53−0.7%2
2021-12-01$99.032022-01-04$97.73−1.3%34
2022-03-07$96.872022-03-11$95.14−1.8%4
2022-05-31$89.442022-06-02$88.92−0.6%2
2022-07-06$90.042022-08-23$88.33−1.9%48
2022-11-16$84.532022-12-30$83.96−0.7%44
2023-01-09$86.022023-02-13$85.12−1.1%35
2023-03-16$87.572023-05-22$86.25−1.5%67
2023-11-08$82.242024-02-12$85.514.0%96
2024-03-08$86.432024-03-18$84.87−1.8%10
2024-03-28$85.692024-04-02$84.66−1.2%5
2024-05-14$84.602024-10-08$88.845.0%147
2024-12-04$87.902024-12-18$87.29−0.7%14
2025-01-31$87.102025-05-14$88.611.7%103
2025-06-05$89.722025-06-10$89.20−0.6%5
2025-06-12$89.822025-12-12$93.043.6%183
2025-12-29$93.712026-01-20$92.78−1.0%22
2026-02-10$93.892026-03-16$93.72−0.2%34
2026-04-20$93.972026-04-29$93.09−0.9%9
2026-06-17$93.232026-07-13$92.53−0.8%26
2026-08-27$92.662026-08-31$92.08−0.6%4

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 26 closed trades

The rule closed 26 round trips and none were open at the end. The median trade returned -0.63% and lasted 22 days. The shortest lasted 2 days and the longest 183 days. Five trades won, and the longest losing streak was 10 trades while the longest winning streak was 1. No two winners ever came in a row.

The five best trades were 5.01% from 2024-05-14, 3.98% from 2023-11-08, 3.58% from 2025-06-12, 2.45% from 2021-05-25 and 1.73% from 2025-01-31. The first four held between 96 and 183 days, and all of them started when the fund was in a clear rise. The trade entered on 2025-06-12 at 89.82 was held 183 days and sold on 2025-12-12 at 93.04. This is the pattern the rule is built for, and it produced the whole profit: a few long holds that more than covered a long list of 2 to 10 day losses.

The five worst were -1.9% from 2022-07-06, -1.8% from 2024-03-08, -1.79% from 2022-03-07, -1.51% from 2023-03-16 and -1.31% from 2021-12-01. The worst loss in the test was small, 1.9%, because a Treasury fund seldom moves far in a few weeks. The size of the average loss, -0.89%, shows the same thing. A losing crossover on IEF costs about a percent, and a winning one makes about three or four.

Trades by exit year were 6 in 2021, 5 in 2022, 2 in 2023, 5 in 2024, 3 in 2025 and 5 in 2026. The winners by year were 1, 0, 0, 2, 2 and 0.

The last trade shows the whipsaw clearly. It entered on 2026-08-27 at 92.66 and exited on 2026-08-31 at 92.08 for -0.63%. It lasted 4 days. The rule bought a fast-over-slow cross and sold it before the next week. Several of the 2021 trades behave the same way, including three entries in September and November that lasted between 2 and 5 days and lost between 0.03% and 0.65%.

Largest drawdowns

PeakLow pointDepthDays to lowRecoveredDays to recover
2021-08-032023-11-09−10.6%8282025-11-25747
2025-11-262026-08-31−4.5%278not yet–
2021-04-222021-06-03−1.2%422021-06-107

Buy-and-hold's deepest drawdown ran from 2021-01-04 to 2023-10-19 and reached −21.8%.

Drawdowns

The deepest drawdown of the rule was 10.63%, from a peak on 2021-08-03 to a trough on 2023-11-09, 828 days later. It recovered on 2025-11-26, 747 days after the trough. Buy-and-hold fell 21.77% from 2021-01-04 to 2023-10-19, which took 1,018 days, and it had not recovered by 2026-10-02. The fund's own profile lists a 22.23% fall over the same dates.

The rule's trough came three weeks after the fund's, on 2023-11-09. That order matters. The rule's equity was still drifting down while the fund bottomed, because the entries in early 2023 lost money and the rule then sat out most of the autumn. The next entry, on 2023-11-08, was a day before the rule's own low, and the equity curve turned up from there.

The second drawdown started on 2025-11-26 and had reached 4.53% by 2026-08-31, 278 days later, with no recovery by the end of the data. It consists of the five losing trades of 2026 plus the loss on the entry of 2025-12-29. A third, shallow drawdown ran 1.23% in spring 2021 and recovered in 7 days after the trough on 2021-06-03.

The rule cut the fund's depth without making the fund's loss go away. The drawdown gap to buy-and-hold was 11.14 points, which is the main thing the rule delivered here. A reader who holds Treasuries for their stability will notice that the rule still lost 10.63% from a bond fund.

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)−0.4%−10.6%$9,778-0.06
5 basis points−0.8%−11.6%$9,534-0.15
10 basis points−1.3%−12.6%$9,295-0.24

Trading costs

No cost is charged in the headline run. Adding 5 basis points to every fill pulls CAGR to -0.83%, the drawdown rises to 11.58%, the ending value drops to $9,534.06 and the Sharpe ratio is -0.15. At 10 basis points it is -1.26%, the drawdown 12.55%, the ending value $9,295.32 and the Sharpe -0.242.

The rule made 52 fills in the headline run, which is two for each of its 26 round trips. Every fill carries the cost, so the charge adds up over the window even though each trade is small. The average winner is 3.35%, and a cost of 10 basis points on both sides is a small slice of that. The weight falls on the average loser of -0.89%, since each losing trade carries the same charge on top.

IEF trades with an average daily dollar volume of $675,908,601 and a median minute volume of 7,536 shares. A sleeve this size should fill close to the quote on a fund that liquid, which makes the 5 and 10 basis point runs a plausible range. They are still assumptions, and the test has no model of the real spread.

Changing the parameters

VersionCAGRMax drawdownRound tripsWin rateFinal value
Published rules−0.4%−10.6%2619%$9,778
EMA 8/21−0.3%−9.4%3628%$9,806
EMA 20/50−0.3%−10.9%1436%$9,857
EMA 12/50−0.3%−9.3%1631%$9,823

Parameter variants

Three variants of the rule ran on the same data. EMA 8/21 returned -0.34% a year with a 9.38% drawdown, 36 trades and 10 wins. EMA 20/50 returned -0.25% with a 10.95% drawdown, 14 trades and 5 wins. EMA 12/50 returned -0.31% with a 9.29% drawdown, 16 trades and 5 wins. The base 12/26 rule returned -0.39% with a 10.63% drawdown and 26 trades.

All four are within about a tenth of a point of each other in CAGR, and all four are negative. The result does not depend on one choice of lengths. Slower pairs traded less, 14 and 16 times, and the faster 8/21 pair traded 36 times with 10 wins. Sharpe ratios were -0.047, -0.033 and -0.045 for the variants against -0.06 for the base rule. None of the variants made money.

This is useful in one way. A rule that only works for one pair of lengths is likely fitted to the sample. Here the opposite holds: no length found a trend that paid on IEF in this window. The 20/50 pair, the slowest, had the best CAGR and the fewest trades, which fits a fund whose moves were too small for fast signals to pay.

How IEF behaved

MeasureIEF
Data in this test2021-01-04 to 2026-10-02 (1444 sessions)
Total return, buy and hold−12.9%
Annualized volatility7.4%
Deepest drawdown−22.2% (2021-01-04 to 2023-10-19)
Up days48.5%
Average daily range0.42%
Average overnight gap0.26%
Correlation to SPY0.09
Correlation to QQQ0.10
Correlation to TLT0.91
Sessions above the 200-day average53.0%
Crossings of the 200-day average60
Falls of 10% or more from a 20-day high0

How IEF behaved

IEF is an intermediate Treasury fund, described in the data as a common 60/40 diversifier. Its total return over the window was -12.95% and its CAGR was -2.39%. Year by year the fund returned -3.35% in 2021, -15.16% in 2022, 3.64% in 2023, -0.63% in 2024, 8.03% in 2025 and -4.58% in 2026 to date. The fund's worst year was far larger than its best.

The best days were 2.26% on 2022-09-28, 2.24% on 2022-11-10 and 1.83% on 2023-03-10. The worst were -1.77% on 2022-06-13, -1.68% on 2022-09-26 and -1.52% on 2022-03-02. The largest moves all fell in 2022 and early 2023, the period when the rule took its losses and also its protection.

The fund's overnight gaps explain much of its return. The overnight share of its log return was 81.25% and the intraday share 18.75%. A rule that buys at the open and sells at the open, as this one does, takes the overnight move at each switch, so the signal day and the entry day differ by a gap.

IEF moved with long Treasuries and barely with equities. Its SPY correlation was 0.09 and its QQQ correlation 0.1, with betas of 0.04 and 0.03. Against TLT the correlation was 0.91 and the beta 0.44. The inverse bond fund TBF sat at the far end with -0.91, and KMLM, RINF, CTA and USDU were the other negative readings, between -0.44 and -0.35. Near-twins were BND (0.98), AGG and IEI (0.97 each), UST and IGIB.

Price sat over its 200-day average for 53.01% of the 1,444 sessions and crossed that line 60 times. Even the slowest trend line was crossed often, which is the setting where a 12/26 pair whipsaws. No session had a 10% fall from a 20-day high. RSI(14) dipped under 30 on 64 sessions; the median 20-day move that followed was -1%, where the baseline was -0.02%. Oversold readings on IEF did not mark a bounce in this window.

Among bond funds, the rule's results on SGOV were 3.21% CAGR, IGIB 2.35%, AGG 1.07%, BND 1.02% and IEI 0.87%. IEF at -0.39% and TLT at -0.67% were the two lowest of the seven, and they are the two funds with the longest maturities. Longer duration meant larger drawdowns in 2022, 10.63% for IEF and 15.92% for TLT, and more round trips: 26 for IEF against 17 for SGOV. The category's median CAGR was 1.02%.

The rules

Hold while the 12-day exponential average is above the 26-day, the core of the MACD used as a position switch.

  1. WHEN the market opens · IF not invested AND EMA(12) > EMA(26) · THEN buy with 98% of the sleeve
  2. 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.

What an exponential crossover does on a Treasury fund

An exponential average gives more weight to recent closes than a simple average does. The 12-day version reacts to a change in direction quickly, and the 26-day version reacts more slowly. When the fast line crosses above the slow line, the rule treats that as an uptrend and buys. When it crosses back, the rule sells. Nothing else is in the logic: no stop, no target, no volatility filter.

That design works best when a fund moves in long swings with few reversals. IEF is a poor fit for part of the window. Its annualized volatility was 7.39%, its average up day and average down day were each 0.36%, and the average intraday range was 0.42%. These are small moves. A crossover on a series that moves this little flips often, because the two averages sit close together and cross on minor wiggles.

The day-to-day behaviour shows no pattern for the rule to use. Daily returns had a lag-1 autocorrelation of -0.01, which means one day told you almost nothing about the following one. The fund rose on 48.51% of days. A trend rule needs persistence, and daily persistence was absent here. What the fund did have was a long slide, and that is a different kind of trend that the crossover can catch only after it has started.

Each switch also costs something even without fees. The rule buys at the open after the signal, which means it enters after the fast line has already crossed. On a fund with a 0.26% average overnight gap, a late entry can give back a meaningful share of a small move. The trades below show how often that happened.

The same fund under the other templates

Ranked by CAGR on IEF, the bottom of the table is the monthly cycle at -2.69% with a 24.73% drawdown, then trend plus trailing stop at -2.13%. The weekly 7% target made -1.54% and the 200-day regime filter -1.53%, with 3-month momentum a little above at -1.35%. Each of these five finished behind the EMA 12/26 rule.

RSI mean reversion sits just below the rule at -0.84%, so the order among the middle group is tight. The golden cross came out at -0.29% with an 8.52% drawdown, only just in front. At the top, SMA 10/50 trend returned 1.33% with a 5.67% drawdown, the shallowest of the group that traded, and the RSI(2) snapback returned 1.84% with a 12.86% drawdown. The dip buyer and momentum breakout rules recorded 0% on IEF because no signal fired.

The ETF hub for IEF lays all twelve results side by side, and the rule's own hub has its results on all 59 funds. The test covers one window, daily decisions and no margin, with no fees in the headline run.

Run EMA 12/26 trend on IEF 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 EMA 12/26 trend beat buy-and-hold on IEF?

Over 2021-01-04 to 2026-10-02, EMA 12/26 trend on IEF returned −0.4% annualized vs −2.3% for buy-and-hold: it beat buy-and-hold by 1.9% per year, with a maximum drawdown 11.1 points shallower than holding (10.6% vs 21.8%).

How many trades did it make?

26 completed round trips over 5.7 years (52 fills), with 19% 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.

Did the EMA 12/26 trend rule make money on IEF?

No. From 2021-01-04 to 2026-10-02 it turned $10,000 into $9,778.03, a CAGR of -0.39%. Buy-and-hold on IEF ended at $8,755.84, so the rule lost less than the fund. The result is hypothetical and the headline run has no fees.

How many trades did the rule make on IEF?

The rule completed 26 round trips and 52 fills, with 5 winners (19%). The median trade lost 0.63% and lasted 22 days, and the longest hold was 183 days.

What was the worst drawdown?

The rule fell 10.63% from 2021-08-03 to 2023-11-09 and recovered on 2025-11-26. Buy-and-hold fell 21.77% from 2021-01-04 to 2023-10-19 and had not recovered by the end of the data.

Do other EMA lengths work better on IEF?

Not in this window. EMA 8/21 returned -0.34% a year, EMA 20/50 returned -0.25% and EMA 12/50 returned -0.31%. The base 12/26 rule returned -0.39%, so all four were negative and within a tenth of a point of each other.

How much do trading costs change the result?

Charged 5 basis points a fill, the rule ends at $9,534.06 with a CAGR of -0.83%. At 10 basis points the ending value is $9,295.32 and the CAGR -1.26%. The headline run has no costs.

Which template did best on IEF?

Short-term RSI(2) rules led at 1.84% and the slow SMA 10/50 trend rule followed at 1.33%. The EMA 12/26 rule ranked 6th of 12 at -0.39%. The [IEF hub](/learn/etf/ief/) has the full ranking.

Is IEF a good fit for a trend rule?

The fit was weak here. The fund fell for three years and kept crossing its 200-day average. Daily returns had a lag-1 autocorrelation of -0.01, so short swings gave the rule little to follow.

Related

EMA 12/26 Trend on all 59 ETFsfull results table All strategies on IEF12 templates compared RSI(14) Mean Reversion on IEFsame ETF, different rulesRSI(2) Dip Snapback on IEFsame 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.