MACD
MACD stands for Moving Average Convergence Divergence. It is one number computed from price: the 12-period exponential moving average minus the 26-period exponential moving average. When the shorter average sits above the longer one, the number is positive. When it sits below, the number is negative. Zero marks the moment the two averages cross.
Traders usually draw three things from it. The MACD line is the 12 minus 26 difference. The signal line is a 9-period exponential average of the MACD line. The histogram is the gap between the two. Reading it means watching for the MACD line to cross the signal line, or to cross zero, and treating either event as a shift in momentum.
The 12/26 relationship underneath can be traded without the signal line. Hold the asset while the 12-day exponential average is above the 26-day, and step aside when it is below. That is a long or flat switch, and DeployQuant tests it as the EMA 12/26 trend template. The rules are two lines. Buy with 98% of the sleeve when not invested and EMA(12) is above EMA(26). Sell the whole position when invested and EMA(12) falls below EMA(26). Decisions happen at the market open, once a day.
The test data below runs from 2021-01-04 to 2026-10-02 on minute-resolution US data, across 59 funds. Each run started with $10,000, took no margin, and charged no fees or slippage in the headline result. The numbers are hypothetical and cover one window of 5.74 years.
EMA 12/26 Trend across 59 ETFs
Median CAGR 2.8%, median max drawdown −22.9%, ahead of buy-and-hold on 22 of 59 (2021-01-04 to 2026-10-02).
| ETF | CAGR | Buy & hold | Max DD | Round trips |
|---|---|---|---|---|
| SOXL | 26.2% | 33.3% | −65.4% | 22 |
| TECL | 19.8% | 38.2% | −53.5% | 26 |
| SPUU | 19.1% | 22.5% | −22.9% | 21 |
| SOXX | 18.0% | 31.1% | −34.0% | 22 |
| ROM | 17.9% | 30.2% | −42.5% | 23 |
| REW | −18.5% | −36.1% | −71.7% | 22 |
| SQQQ | −24.3% | −42.3% | −82.8% | 21 |
| TECS | −29.4% | −46.7% | −87.8% | 21 |
| UVXY | −39.0% | −48.7% | −96.0% | 19 |
| SOXS | −48.4% | −48.3% | −97.8% | 28 |
The five strongest and five weakest results. All 59.
What the 12/26 switch did across 59 funds
Across the 59 funds, the EMA 12/26 trend template had a median CAGR of 2.76% and a median maximum drawdown of 22.87%. Its median Sharpe ratio was 0.42, its median exposure was 59.3% of the time, and it made 22 round trips at the median. It beat buy-and-hold on 22 of the 59 funds and had a shallower drawdown than buy-and-hold on 54. It finished with a positive CAGR on 41.
The pattern in those figures is common to trend switches. Sitting in cash for the rest of the time, which is the 59.3% exposure figure turned around, lowers the drawdown on most funds and lowers the gain on the funds that rose. The switch gave up return to buy-and-hold on more than half of the funds, and gave back less on the downside on nearly all of them.
The table above lists the five best and five worst funds for the rule. SOXL had the best result at 26.2% CAGR with a 65.4% maximum drawdown, against buy-and-hold at 33.3%. TECL made 19.8% against 38.2%. SPUU made 19.1% against 22.5% with a drawdown of 22.9%. SOXX made 18.0% against 31.1%. ROM made 17.9% against 30.2%. In every one of those five, the rule trailed buy-and-hold on CAGR. Its edge there was on the drawdown side, and even that was thin on SOXL and TECL, where the maximum drawdown stayed above 50%.
The five worst results are inverse or volatility funds. REW lost 18.5% a year, SQQQ 24.3%, TECS 29.4%, UVXY 39.0% and SOXS 48.4%. Those funds had even worse buy-and-hold figures, and for four of the five the rule beat buy-and-hold, because staying out of a fund that decays most of the time helps. SOXS is the exception, where the rule matched buy-and-hold within a tenth of a point, at -48.38% against -48.27%, with a win rate of 7% over 28 round trips.
How the number is built
An exponential moving average weights recent closes more than old ones. Each new close pulls the average toward itself by a fixed fraction, and older closes fade out gradually without ever dropping off a cliff. A 12-period average reacts faster than a 26-period one, because its fraction is larger. The EMA glossary entry covers the weighting in more detail.
MACD takes the fast average and subtracts the slow one. In a steady rise the fast average runs ahead of the slow one, and the gap widens. When the rise slows, the fast average flattens first and the gap narrows, which is the convergence in the name. When the fast average drops under the slow one the gap turns negative, and a widening negative gap is the divergence.
The number is in price units, not a percentage, so a MACD of 2 means something different on a fund trading near 30 than on one trading near 400. That is one reason people compare MACD with its own history on the same chart and avoid comparing it across funds.
The signal line smooths the MACD line with a 9-period average. Because it is an average of an average, it lags the MACD line. A MACD crossing above its signal line fires earlier than a MACD crossing above zero, and it fires more often. The cross of the MACD line with zero is the same event as the 12-period average crossing the 26-period average. That equivalence is what makes the template above a fair test of the core idea.
What a crossover does and does not tell you
A crossover says the recent past has been stronger than the slightly older past. That is all it says. The indicator is a function of closing prices and carries no information about the next day, so every signal is a statement about what has already happened.
This matters for the entry. A cross above zero shows up after a rise has started, so the position is bought higher than the low. The cost of that lag is the early part of every move. The benefit is that a cross usually appears when the move has some persistence behind it, and the rule skips the long flat stretches where the two averages sit on top of each other.
The weakness is a choppy market. When price moves sideways, the fast average crosses the slow one back and forth. Each cross is a buy or a sell, and each one is made after the move that triggered it has already reversed. Traders call these momentum failures whipsaws. A faster pair such as 12/26 produces more of them than a slow pair, and the strategy page lists its trade count so the reader can see the cost.
The result by type of fund
Grouped by category, the template is steadiest on broad index funds. Twelve of them had a median CAGR of 7.85% against 14.42% for buy-and-hold, with a median drawdown of 16.81%. None of the 12 funds beat buy-and-hold on CAGR. Sector funds, 6 in the group, had a median CAGR of 5.8% against 12.58%, and again none beat buy-and-hold.
Leveraged funds were the biggest winners in absolute terms, at a median CAGR of 17.3% with a median maximum drawdown of 49.92%, and 2 of the 10 beat buy-and-hold. Bond funds were the one place where the switch helped broadly: its median CAGR was 1.02% against -0.78% for buy-and-hold, it beat buy-and-hold on 6 of 7, and its median drawdown was 4.96%. Currency funds followed a similar pattern, 1.32% against -0.9%, with 2 of 3 ahead.
Inverse funds had a median CAGR of -12.74% against -21.57%, with 9 of 11 ahead of buy-and-hold. Volatility products had -12.95% against -16.06%, with all 3 ahead. In these two groups the rule mostly lost less, and it still lost money.
Year by year
The gap to buy-and-hold was widest in 2024. In 2021 the rule's median was 0% against 4.1% for buy-and-hold. In 2022 it lost 8.3% against 12.7%, and only 15 of 59 funds were positive. In 2023 it made 7% against 8.9%, with 44 funds positive. In 2024 it made 1.7% against 9.7%. In 2025 it made 5.8% against 11.1%, and in 2026 so far 2.8% against 3.7%.
The 2022 row is where the switch did its job: it lost less than the funds themselves, because the 12-day average dropped under the 26-day average and the rule sold. The 2024 row shows the cost. The market rose and the rule was out part of the year, and its median return was a fraction of what holding returned.
Market examples show the same setting. SPY returned 30.46% in 2021, lost 18.16% in 2022, then made 26.18% in 2023 and 24.86% in 2024. QQQ lost 32.39% in 2022 and returned 54.81% in 2023. TQQQ went from -79.07% in 2022 to 198.32% in 2023. A switch that turned slowly after the 2022 low would have missed a share of that rebound.
Changing the pair
The 12/26 numbers are conventional, not special. The template was also tested with other pairs. EMA 8/21 had a median CAGR of 2.87%, a median drawdown of 22.57% and 31 round trips. EMA 12/50 had 2.1%, 23.56% and 16 round trips. EMA 20/50 had 1.17%, 25.29% and 12 round trips. The default, 12/26, had 2.76%, 22.87% and 22 round trips.
The faster pair made more trades and finished slightly ahead. The slower pairs made fewer trades and finished behind. Across this window the four pairs finished within a couple of points of each other in median CAGR, so the choice of 12/26 over the others is a weak result. It also shows the idea does not hinge on the exact lengths.
A comparison with the SMA 10/50 trend template is useful. The simple-average pair of 10 and 50 had a median CAGR of 2.12%, a median drawdown of 23.02%, 17 round trips and a beat-buy-and-hold count of 21 of 59. The EMA pair came out ahead on CAGR and on the count, and made more trades.
How often the switch wins a trade
The trade-level numbers on the best funds show the usual shape of a trend rule. On SOXL the switch had a win rate of 36% over 22 round trips. On TECL the win rate was 38% over 26. SPUU was at 48% over 21, and SOXX at 50% over 22. ROM was at 39% over 23. Most of these funds were profitable overall even though fewer than half of the trades won, because the winning trades during the big runs were larger than the losing ones.
That profile is typical of whipsaw-prone rules. Each small loss comes from a cross that reversed, and the gains come from the few long stretches where the 12-day average stayed above the 26-day average for weeks. A reader who looks only at the win rate would call the rule poor. A reader who looks at the full set of trades sees a few trades doing most of the work, which is the reason the trade list on each strategy backtest page is worth reading.
The exposure column gives the same picture from the other side. SOXL spent 54.6% of the window invested, TECL 59.8%, SPUU 69.1%, SOXX 60.6% and ROM 62.3%. On the weakest funds the rule was invested much less: 35.3% on TMF, 29.6% on REW, 27.1% on SQQQ, 26.5% on TECS, 19.6% on UVXY and 25.5% on SOXS. The rule recognised that those funds spent most of the window under their 26-day average, and stayed out of them most of the time, which is why it lost less than buy-and-hold there.
Limits of this test
The window is one stretch of 5.74 years that opens in 2021, and includes the 2022 bear market. The test traded one fund at a time, long or flat only, once a day, with 98% of the sleeve invested. It did not use the signal line or the histogram, and it did not trade MACD divergences. A trader who uses classic MACD with the signal line is trading a different, faster rule, and these numbers do not describe it. The headline run charges no fees or slippage. A rule with 22 round trips at the median pays little for that, and the cost runs on each backtest page show the effect for each fund.
The test also says nothing about the future. A median of 2.76% CAGR is a summary of 59 different results, from SOXL at 26.2% to SOXS at -48.38%, and no single fund behaves like the median. The strategy hub has the full list for EMA 12/26 trend across all 59 funds, and the backtesting entry explains how the engine's runs are produced.
Frequently asked questions
What does MACD stand for?
Moving Average Convergence Divergence. It is the difference between a 12-period and a 26-period exponential moving average, drawn together with a 9-period exponential average of that difference, called the signal line.
How is MACD calculated?
Subtract the 26-period EMA of the close from the 12-period EMA of the close. That is the MACD line. A 9-period EMA of the MACD line is the signal line, and the gap between the two lines is the histogram.
What is a MACD crossover?
It is an event where the MACD line crosses above or below the signal line, or crosses zero. A cross of the MACD line with zero is the same as the 12-period average crossing the 26-period average.
Can MACD be traded as a simple rule?
Yes. The EMA 12/26 trend template holds the asset while the 12-day EMA is above the 26-day EMA and holds cash otherwise. Over 2021-01-04 to 2026-10-02 it had a median CAGR of 2.76% across 59 funds, with a median maximum drawdown of 22.87%.
Did the MACD rule beat buy-and-hold in the backtest?
On 22 of 59 funds. It had a shallower drawdown than buy-and-hold on 54 funds. On the broad index funds its median CAGR was 7.85% against 14.42% for buy-and-hold, so it gave up return to reduce drawdown.
Does MACD work better with different settings?
The 8/21, 12/50 and 20/50 variants all landed within two points of the default in median CAGR. EMA 8/21 had the highest median at 2.87%, and EMA 20/50 the lowest at 1.17%. The window is one stretch, so the result is not proof of a best setting.
What is the weakness of MACD?
It lags price and it whipsaws when price moves sideways. In the backtest the rule made 22 round trips at the median, and it had a win rate of 7% on SOXS. These results are hypothetical and cover one window.
Backtested on 59 ETFs over 5.7 years with real engine results and a buy-and-hold comparison on every page.
Related terms
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.