EMA 12/26 Trend on IAU
iShares Gold Trust: physical gold exposure, a common crisis hedge. 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 template takes the MACD's two exponential averages and uses them as an on/off switch: long while the 12-day sits over the 26-day, flat otherwise. IAU holds physical gold. The backtest runs from 2021-01-04 to 2026-10-02 on a $10,000 account with no fees in the headline figures.
The account ended at $19,666, a gain of 96.66% or 12.5% a year. Worst peak-to-trough loss was 14.97% and the Sharpe ratio 0.89. Twenty-three round trips closed, and 11 made money (48%). Winners averaged 9.01% and losers -1.68%, giving a profit factor of 5.49. The account held gold 59.3% of the time.
Simply holding IAU earned a little more. It compounded at 13.66% and ended at $20,857, so the switch gave up about 1.16 points of CAGR. The drawdown comparison favors the switch. Holders sat through a 26.16% slide from 2026-01-29 to 2026-07-16, and the rule's worst was 14.97%. Calendar years split evenly: the rule led in 2021, 2022 and 2026 and lagged in 2023, 2024 and 2025.
Of the 12 templates on IAU, this one ranks 4th. Of the 59 funds, IAU ranks 9th for this template, whose median CAGR over all 59 is 2.76%. Gold suited the crossover better than most funds did. The test covers one fund and one 5.74 year window with daily decisions, and the headline number carries no costs.
Year by year
| Year | EMA 12/26 trend | buy & hold |
|---|---|---|
| 2021 | −4.3% | −6.0% |
| 2022 | 3.4% | −0.6% |
| 2023 | 5.8% | 12.6% |
| 2024 | 13.3% | 26.3% |
| 2025 | 54.1% | 62.9% |
| 2026 | 7.7% | −3.9% |
Year by year against holding
Calendar returns for the rule were -4.3% (2021), 3.4% (2022), 5.8% (2023), 13.3% (2024), 54.1% (2025) and 7.7% (2026 to date). Holding gave -6%, -0.6%, 12.6%, 26.3%, 62.9% and -3.9% over the same years. The gaps mark where the switch helped and where it lagged.
The first three years were flat or negative for gold. In 2021 the rule lost 4.3% against 6% for holding, a small edge. The rule did not buy until 2021-04-19, so January to March show 0% in the monthly table. Its first trade lasted 60 days and returned 0.18%. May 2021 added 7.47% and June took back 6.6%, and the August and September trades lost a little each.
2022 was the best year relative to holding. Holders lost 0.6% and the rule made 3.4%. February returned 4.92% and March 1.35% on a position bought on 2022-02-08 and sold on 2022-04-27 for 3.75%. The rule then sat out May, June and July, bought on 2022-08-09 and sold on the crossover on 2022-08-23 for -3.32%. It entered again on 2022-11-10 at an adjusted 33.043 and held to 2023-02-15.
2023 went the other way. Holding returned 12.6% and the rule 5.8%, so the switch trailed by 6.8 points. January 2023 gained 5.6% and February lost 4.82%. Then the rule had five losing or flat trades between July and October, including three that lasted one or two days in September. Those short trades are the whipsaws the template warns about.
2024 and 2025 were the strong gold years. The rule made 13.3% in 2024 while holding made 26.3%. The long position from 2024-02-29 to 2024-06-11 returned 12.85%, and 2024-07-08 to 2024-11-14 added 7.78%. November lost 6.58% and December 3.22% as the averages crossed down, the rule re-entered on 2024-12-12 and sold again a week later. In 2025 the rule made 54.1% against 62.9%. The trade from 2025-01-13 to 2025-07-10 returned 24.35%, and the one from 2025-08-25 to 2026-03-20 returned 38.16%.
The 2026 row stops at 2026-10-02. There the rule made 7.7% while holders lost 3.9%, the largest lead of any year. January and February added 12.29% and 8.36% inside the long trade. March lost 11.4% when the rule exited on 2026-03-20. The rule then held cash from April to July, bought on 2026-08-07 and sold on 2026-09-16 for -0.12%.
Month by month
| Year | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2021 | 0.0% | 0.0% | 0.0% | −0.2% | 7.5% | −6.6% | 0.0% | −2.2% | −3.3% | −0.1% | −0.7% | 1.8% |
| 2022 | −1.6% | 4.9% | 1.4% | −2.3% | 0.0% | 0.0% | 0.0% | −3.3% | 0.0% | 0.0% | 1.6% | 2.9% |
| 2023 | 5.6% | −4.8% | 2.5% | 0.9% | −0.8% | 0.0% | −0.6% | −1.2% | −1.0% | 1.7% | 2.5% | 1.3% |
| 2024 | −1.9% | −1.7% | 8.5% | 3.0% | 1.6% | −0.6% | 3.1% | 2.1% | 5.0% | 4.3% | −6.6% | −3.2% |
| 2025 | 4.8% | 1.9% | 9.2% | 5.3% | −0.1% | 0.4% | −1.0% | 1.7% | 11.5% | 3.5% | 5.3% | 2.1% |
| 2026 | 12.3% | 8.4% | −11.4% | 0.0% | 0.0% | 0.0% | 0.0% | 2.2% | −2.2% | 0.0% | – | – |
The months
The best month was January 2026 at 12.29% and the worst was March 2026 at -11.4%. Buy-and-hold had a best month of 12.4% in January 2026 and a worst of -11.59% in June 2026. The rule was in cash for June 2026, so it avoided that month, but it took the March 2026 loss that holding also had in part.
September 2025 (11.52%), March 2025 (9.19%) and March 2024 (8.49%) were the next best. November 2024 (-6.58%), June 2021 (-6.6%) and February 2023 (-4.82%) were the next worst. Gold's average daily range of 0.98% keeps most months in a narrow band.
Months at exactly 0% had no position: January to March 2021, May to July 2022, September and October 2022, June 2023 and April to July 2026. Those flat stretches kept the rule out of gold's drift in mid-2022 and out of the pullback in early summer 2026.
IAU's own calendar pattern shows June as the only month with a clearly negative average, at -3.72%, and January as the best at 4.39%. Each calendar month appears only 5 or 6 times, so these averages describe this window and nothing more.
Every trade
EMA 12/26 trend on IAU made 23 closed round trips, an average hold of 54 days, an average winner of 9.01%, an average loser of −1.68%, a profit factor of 5.49, a longest losing streak of 2. It held a position at the close on 59.3% of trading days.
| Entry | Entry price | Exit | Exit price | Return | Days held |
|---|---|---|---|---|---|
| 2021-04-19 | $33.76 | 2021-06-18 | $33.82 | 0.2% | 60 |
| 2021-08-05 | $34.45 | 2021-08-06 | $33.68 | −2.2% | 1 |
| 2021-08-30 | $34.54 | 2021-09-17 | $33.37 | −3.4% | 18 |
| 2021-10-21 | $33.94 | 2021-12-01 | $33.97 | 0.1% | 41 |
| 2021-12-28 | $34.47 | 2022-02-02 | $34.29 | −0.5% | 36 |
| 2022-02-08 | $34.64 | 2022-04-27 | $35.94 | 3.8% | 78 |
| 2022-08-09 | $34.14 | 2022-08-23 | $33.01 | −3.3% | 14 |
| 2022-11-10 | $33.04 | 2023-02-15 | $34.78 | 5.3% | 97 |
| 2023-03-15 | $36.44 | 2023-05-22 | $37.39 | 2.6% | 68 |
| 2023-07-19 | $37.43 | 2023-08-07 | $36.75 | −1.8% | 19 |
| 2023-09-05 | $36.60 | 2023-09-07 | $36.39 | −0.6% | 2 |
| 2023-09-21 | $36.30 | 2023-09-22 | $36.47 | 0.5% | 1 |
| 2023-09-25 | $36.42 | 2023-09-26 | $36.08 | −0.9% | 1 |
| 2023-10-19 | $36.94 | 2024-01-23 | $38.29 | 3.6% | 96 |
| 2024-02-02 | $38.43 | 2024-02-13 | $37.83 | −1.6% | 11 |
| 2024-02-29 | $38.74 | 2024-06-11 | $43.73 | 12.8% | 103 |
| 2024-07-08 | $44.89 | 2024-11-14 | $48.38 | 7.8% | 129 |
| 2024-12-12 | $50.69 | 2024-12-19 | $49.02 | −3.3% | 7 |
| 2025-01-13 | $50.37 | 2025-07-10 | $62.63 | 24.4% | 178 |
| 2025-07-14 | $63.27 | 2025-07-31 | $62.33 | −1.5% | 17 |
| 2025-08-06 | $63.52 | 2025-08-20 | $62.98 | −0.8% | 14 |
| 2025-08-25 | $63.41 | 2026-03-20 | $87.61 | 38.2% | 207 |
| 2026-08-07 | $81.91 | 2026-09-16 | $81.81 | −0.1% | 40 |
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 trades
All 23 round trips closed, with 46 fills, and nothing was open on the last day. A typical trade returned -0.12% over 36 days. Average hold was 53.8 days, the longest 207 days and the shortest 1 day. Winners never came more than twice in a row, and neither did losers.
The distribution is lopsided. Eleven trades won and twelve lost, yet the profit factor is 5.49. The five best trades were 38.16% (2025-08-25 to 2026-03-20, 207 days), 24.35% (2025-01-13 to 2025-07-10, 178 days), 12.85% (2024-02-29 to 2024-06-11, 103 days), 7.78% (2024-07-08 to 2024-11-14, 129 days) and 5.26% (2022-11-10 to 2023-02-15, 97 days). All five held for more than three months. The worst trades were -3.4% (2021-08-30 to 2021-09-17), -3.32% (2022-08-09 to 2022-08-23), -3.3% (2024-12-12 to 2024-12-19), -2.24% (2021-08-05 to 2021-08-06) and -1.83% (2023-07-19 to 2023-08-07).
The largest loss was 3.4%. A crossover exit on a fund that moves 0.83% on an average day tends to close a loser while it is still small. The winners ran because the 12-day average stayed over the 26-day through long advances, such as the one that began in August 2025.
The cluster in September 2023 shows the cost of a fast average. The rule bought on 2023-09-05, sold on 2023-09-07, bought again on 2023-09-21, sold the next day, then bought on 2023-09-25 and sold on 2023-09-26. The three trades returned -0.59%, 0.47% and -0.93%. Price was moving sideways and the two averages kept crossing.
By year of exit, 2021 had four round trips with two wins, 2022 three with one, 2023 six with three, 2024 five with three, 2025 three with one and 2026 two with one. Win rates by year are close to a coin flip, and the result came from the few large trades.
Largest drawdowns
| Peak | Low point | Depth | Days to low | Recovered | Days to recover |
|---|---|---|---|---|---|
| 2026-01-29 | 2026-09-14 | −15.0% | 228 | not yet | – |
| 2021-06-02 | 2022-01-06 | −13.0% | 218 | 2024-03-20 | 804 |
| 2024-10-30 | 2025-01-13 | −11.1% | 75 | 2025-03-18 | 64 |
Buy-and-hold's deepest drawdown ran from 2026-01-29 to 2026-07-16 and reached −26.2%.
The drawdowns
The report lists three drawdowns. The deepest started at the 2026-01-29 peak and bottomed at 14.97% on 2026-09-14, 228 days on, and the account was still below that peak at the end. The second began on 2021-06-02, fell 13.02% by 2022-01-06 and took until 2024-03-20 to recover, which is 804 days. The third ran 11.12% from 2024-10-30 to 2025-01-13 and recovered by 2025-03-18, 64 days after the low.
The first of these is the more revealing. Buy-and-hold had its own drawdown from the same peak date of 2026-01-29, which reached 26.16% on 2026-07-16 and had also not recovered. The rule sold on 2026-03-20 after the January and February run, which is why its fall from that peak was shallower. The drawdown then extended to September because the August entry lost a little and the account stayed below its January high.
The 804 day recovery from 2021 to 2024 is the longest. Gold itself drifted in 2021 and 2022, and the rule strung together small losses and flat trades. Holding had a deeper 20.53% drawdown from 2022-03-08 to 2022-09-26 that took 431 days to recover, and a 13.6% one in early 2021 that recovered in 361 days.
The fund's own longest drawdown lasted 436 sessions and its deepest was 26.36%. It had 7 falls of 10% or more from a 20-day high, covering 20 days in all. With 59.3% exposure, the rule was in cash for part of these.
What the 2026-01-29 peak looked like from inside the position
The rule was long IAU on the day the fund peaked. It had bought on 2025-08-25 at an adjusted 63.41, and the trade was still open when the fund recorded its worst day of the window, -10.09% on 2026-01-30. Three of the fund's five best days came in the same stretch, led by 6.23% on 2026-02-03, and the rule held through all of them because the 12-day average stayed over the 26-day.
The exit came on 2026-03-20 at 87.61, after the fund had also taken a -4.42% day on 2026-03-03 and a -4.15% day on 2026-03-19. The sale filled on 2026-03-20, the session after the second of those drops. The sale locked in the 38.16% trade, the best of the 23. March 2026 still shows -11.4% because most of the slide happened before the crossover fired.
The crossover does not react to a single bad day. One large down day moves a 12-day exponential average only part of the way toward price, so a gap of 10% in one session did not flip the rule by itself. The exit needed a run of lower closes. For a fund with a 0.98% average intraday range, that lag cost the rule most of the March fall and still left it ahead of holders on drawdown.
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% | −15.0% | $19,666 | 0.89 |
| 5 basis points | 12.1% | −15.1% | $19,247 | 0.86 |
| 10 basis points | 11.6% | −15.1% | $18,806 | 0.83 |
Trading costs
Adding 5 basis points of slippage to every fill lowered the CAGR to 12.08% and the ending balance to $19,247. With 10 basis points the figures were 11.63% and $18,806. The maximum drawdown moved from 14.97% to 15.07% and then 15.14%. The Sharpe ratio went from 0.89 to 0.858 and 0.83.
Forty-six fills over 5.74 years leave costs little room to hurt. IAU trades about $383,606,697 a day, and a typical minute carries 7,446 shares. Even at 10 basis points the CAGR is within a point or so of the headline. These runs model slippage only, and they do not model taxes or the gap between a minute-bar fill and a live fill.
Changing the parameters
| Version | CAGR | Max drawdown | Round trips | Win rate | Final value |
|---|---|---|---|---|---|
| Published rules | 12.5% | −15.0% | 23 | 48% | $19,666 |
| EMA 8/21 | 12.8% | −15.4% | 32 | 41% | $19,974 |
| EMA 20/50 | 14.8% | −22.3% | 9 | 67% | $22,035 |
| EMA 12/50 | 13.5% | −21.7% | 12 | 58% | $20,711 |
Changing the parameters
Three alternatives were run beside the published 12/26. EMA 8/21 returned 12.81% with a 15.42% drawdown, 32 trades and 13 wins. EMA 20/50 returned 14.75% with a 22.29% drawdown, 9 trades and 6 wins. EMA 12/50 returned 13.52% with a 21.66% drawdown, 12 trades and 7 wins. The published rule returned 12.5% with a 14.97% drawdown on 23 trades.
The slower pairs earned more return and took more drawdown. EMA 20/50 had the highest CAGR and the best Sharpe at 0.993,. It also gave up the shallow drawdown, which was the rule's main advantage over holding. Its drawdown of 22.29% is closer to the 26.16% for holding than to the published 14.97%.
The faster pair, 8/21, made more trades and won a smaller share of them, 41%. Its CAGR of 12.81% was close to the default, and the extra trades did not add much. Across the four settings the CAGR range is narrow, from 12.5% to 14.75%, and the ending balances run from $19,666 to $22,035. All four sit near the buy-and-hold ending balance of $20,857. The parameter choice moved drawdown more than it moved return. Nine to 32 trades per setting is a small sample, and the order of the settings could change in another window.
How IAU behaved
| Measure | IAU |
|---|---|
| Data in this test | 2021-01-04 to 2026-10-02 (1444 sessions) |
| Total return, buy and hold | 110.3% |
| Annualized volatility | 18.3% |
| Deepest drawdown | −26.4% (2026-01-29 to 2026-07-16) |
| Up days | 53.3% |
| Average daily range | 0.98% |
| Average overnight gap | 0.61% |
| Correlation to SPY | 0.16 |
| Correlation to QQQ | 0.16 |
| Correlation to TLT | 0.21 |
| Sessions above the 200-day average | 78.0% |
| Crossings of the 200-day average | 44 |
| Falls of 10% or more from a 20-day high | 7 |
How IAU behaved
On its own price IAU gained 110.28%, or 13.82% a year, with annualized volatility of 18.26%. By year it ran -6.12%, -0.57%, 12.83%, 26.84% and 63.89% from 2021 to 2025, then -3.96% in 2026 to date. The 2025 leg supplied most of the gain.
IAU closed up on 53.29% of days. Up days averaged 0.83% and down days -0.83%. Its average intraday range was 0.98% and its average overnight gap 0.61%. The overnight share of the return is 108.93%, which means the fund's gain came from the gap between close and next open, and intraday trading was a net negative at -8.93%. Every entry here happens at the open, after the signal fires on the prior close. When the overnight move carries the return, part of each advance is already in the price by the time the order fills.
Gold acted as a diversifier. Correlation with SPY was 0.16, with QQQ 0.16 and with TLT 0.21, and beta to SPY was 0.18. UDN (0.44) and FXE (0.4) were its closest matches, and USDU (-0.44) its opposite.
Price closed over the 200-day average on 77.99% of sessions and crossed that line 44 times. Long stretches on one side suit a trend switch. Day-to-day autocorrelation was -0.02, so one day's move said almost nothing about the next.
The RSI readings hint at mild mean reversion. After RSI(14) closed under 30 (45 sessions) the median 20-day return was 2.8%, against 1.01% on all days. After RSI(2) closed under 10 (152 sessions) it was 1.59%. Oversold signals preceded above-average returns but were infrequent.
Weekday and month-of-year averages for gold
IAU's average daily return was close to flat on every weekday. Wednesday was the highest at 0.11% and Monday the lowest at 0.03%, with Tuesday at 0.06%, Thursday at 0.04% and Friday at 0.05%. A long/flat rule that checks only at the open gains nothing from any one weekday.
The month-of-year table has more spread. January averaged 4.39% over 5 observations and October 3.02% over 5. June was the one clearly negative month at -3.72% over 6. The rule's own June record fits that: June 2021 lost 6.6% while the rule held a position, and June 2026 sat in cash.
The sample is six calendar years, so each average rests on 5 or 6 data points and one year of 2025's size can dominate it. The rule has no calendar input and none of these averages was used to set the 12 and 26 day lengths.
The fund's closest correlations were with currency funds, UDN at 0.44 and FXE at 0.4, and QAI at 0.34 among alternatives. Its negative correlates included SOXS at -0.19 and TECS at -0.16, both inverse technology funds, which fits gold's low 0.13 beta to QQQ.
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 rules fit this fund
The rules have two lines. While flat, buy with 98% of the sleeve at the open once EMA(12) is above EMA(26). While long, sell all of it at the open once EMA(12) drops below EMA(26). No stop, target or volatility filter exists. The template notes warn of more trades and whipsaws than a 50/200 cross, and the IAU trade list shows both halves of that.
The whipsaws were small on gold. Five of the 12 losing trades lost 1% or less, and the worst lost 3.4%. The sustained trends paid for them, which is why the profit factor reached 5.49.
Other templates on IAU gave the following. The weekly 7% target returned 16.35% a year with a 27.66% drawdown, the trend plus trailing stop 13.09% with 30.44% and the 200-day regime filter 12.98% with 20.02%. This rule placed 4th at 12.5% with the shallowest drawdown of those four. The monthly cycle returned 11.85%, the golden cross 10.79% and the SMA 10/50 trend 10.75%. The 3-month momentum returned 8.51% and the momentum breakout 7.06%. RSI mean reversion made 4.99%, the RSI(2) snapback 4.74% and the dip buyer lost 0.78%.
Trend rules did well on gold in this window and dip rules did poorly. Gold was above its 200-day average most of the time and rarely fell far enough to trigger a dip entry that then recovered. The test stops at one window, and a different five years of gold could rank these templates differently.
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 IAU?
Over 2021-01-04 to 2026-10-02, EMA 12/26 trend on IAU returned 12.5% annualized vs 13.7% for buy-and-hold: it trailed buy-and-hold by 1.2% per year, with a maximum drawdown 11.2 points shallower than holding (15.0% vs 26.2%).
How many trades did it make?
23 completed round trips over 5.7 years (46 fills), with 48% 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 12/26 switch beat simply holding IAU?
Not on return: 12.5% a year against 13.66%, and $19,666 against $20,857. Its maximum drawdown was shallower, 14.97% against 26.16%, and a higher Sharpe ratio of 0.89 against 0.8.
How often did the IAU backtest trade?
There were 23 closed round trips and 46 fills in the window. Eleven were winners. The average hold was 53.8 days and the longest was 207 days.
Why is the profit factor 5.49 with a 48% win rate?
The average winner was 9.01% and the average loser was -1.68%. A few long trades, such as 38.16% and 24.35%, produced most of the gains. The worst single loss was 3.4%.
What was the worst drawdown for the rule on IAU?
It reached 14.97%, between the 2026-01-29 peak and the 2026-09-14 low, and was still open on the last day. Holding had a 26.16% drawdown from the same peak date.
Do trading costs change the result much?
Little. CAGR fell to 12.08% at 5 basis points and 11.63% at 10, from 12.5% with none. The rule needs only 46 fills in 5.74 years.
Which EMA settings did best on IAU?
EMA 20/50 returned 14.75% a year with a 22.29% drawdown and EMA 12/50 returned 13.52% with 21.66%. EMA 8/21 returned 12.81% with 15.42%. The slower pairs made more return and took more drawdown, from only 9 to 12 trades each.
Is this the same as trading MACD on IAU?
It uses the MACD's trend component. The rule switches on the sign of EMA(12) minus EMA(26) and does not use the signal line. That makes it a simple long or flat rule.
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.