Testing MACD Until It Broke

MACD is one of those indicators that almost every trader has seen and almost every systematic trader eventually doubts.

It is simple. It is old. It is on every charting platform. And because it is so easy to test, it is also easy to fool yourself with it.

So we started with a plain question: can MACD still produce a durable trading edge, or does it only look good when you cherry-pick one lucky backtest?

The answer we found was more interesting than yes or no. A plain MACD crossover was not enough. A universal magic setting did not survive. But after a lot of parameter sweeps, market checks, trade-detail reviews, and failed branches, a specialized version did emerge:

A long-only, intraday MACD trend-capture strategy that uses a trend filter, exits when the trend breaks, and limits stale trades with a time stop.

That sentence has jargon in it, so we will unpack it. The important part is that the research did not end with “MACD works.” It ended with a narrower, more honest statement: MACD can be useful as one part of a trend-following rule, mostly on 2h and 4h crypto charts, and mostly when we care about parameter neighborhoods rather than one best row.

This is a research article, not a live-trading recommendation. All results below are historical backtests using TrainBard exports, long-only rules, and TrainBard’s default market assumptions unless otherwise noted. The main research window was roughly 2021-01-01 through 2026-04-26.

The Idea

MACD stands for moving average convergence/divergence. Under the hood, it compares a faster moving average with a slower moving average. When the fast average pulls away from the slow one, MACD rises. When momentum cools, MACD falls.

A common MACD trading rule is a signal-line crossover:

  • Buy when the MACD line crosses above its signal line.
  • Sell when it crosses back below.

The default settings are often written as 12/26/9: a 12-period fast average, a 26-period slow average, and a 9-period signal line.

That default was not our thesis. In fact, trusting one default setting was exactly what we wanted to avoid. A single backtest can lie because one parameter set might get lucky on one market window. So we tested ranges:

  • Many fast lengths.
  • Many slow lengths.
  • Many signal lengths.
  • Multiple exit rules.
  • Multiple trend filters.
  • Multiple symbols and candle sizes.

This is called a parameter sweep. Instead of asking “did one setting work?”, a sweep asks “did a whole region of similar settings work?”

That distinction matters. If only one row wins, the strategy is fragile. If nearby rows also win, we may have found a real behavior in the market.

How We Judged The Tests

The main benchmark was buy and hold: simply buying the asset at the start of the test and holding it to the end. A strategy that makes money but loses to buy and hold may still be interesting, but it has a much higher burden of proof.

We looked for four things:

  1. Median return, not just the best return. The median row is the middle result in a sweep. It tells us whether the whole tested region was healthy.
  2. P25 return, or the lower-quartile result. If P25 is strong, even the weaker part of the neighborhood held up.
  3. Rows above buy and hold. This asks how often the strategy beat the simple benchmark.
  4. Trade path quality. A strategy that makes all its money from one trade is different from one that survives many regimes.

One caveat: the sweep exports had a known max-drawdown calculation issue. Drawdown was represented as a percentage of starting capital, so we treated sweep drawdown as rough relative evidence, not as a precise risk number. Later trade-history exports gave us a cleaner event-level path view, though even that does not capture every intratrade mark.

Version 1: Plain MACD

The first script was intentionally simple: buy on a MACD signal-line crossover and test a few exit choices.

The baseline produced some impressive top rows. The best result returned 589.10%. But the broader result was much less exciting: the median row returned only 59.88%, and just 448 / 2,016 rows beat buy and hold.

That is exactly why range testing is useful. The best row looked great. The neighborhood did not.

StageBest returnMedian returnRows above buy-and-holdWhat it told us
Baseline MACD crossover589.10%59.88%448 / 2,016Some pockets existed, but the broad surface was weak.
Trend-filtered MACD572.97%136.02%19,102 / 51,975The first serious branch.
Bullish pullback variant277.02%76.20%871 / 66,420Cleaner idea, weaker broad evidence.
ATR risk-control variant123.26%20.61%0 / 90,000 uniqueRisk brackets did not explain the edge.

The first important finding was not a MACD length. It was an exit behavior.

Across the early sweeps, the strongest recurring feature was exit_mode=1. In plain English, this meant the strategy did not necessarily exit on the first small MACD wiggle. It held until the broader trend condition failed.

That matters because trend-following strategies usually make money from a few large moves. If the exit is too sensitive, it can cut the winners before they become large enough to pay for the losses.

Adding A Trend Filter

The second major script added a trend filter.

A trend filter is a rule that says “only take long trades when the market is already in a favorable regime.” Here, the filter used a long simple moving average, or SMA. A moving average is just the average price over the last N candles. If price is above that average, or if the average itself is rising, the market may be in an uptrend.

This changed the character of the results.

The trend-filtered branch was not just a better single top row. It had a healthier neighborhood: median return rose to 136.02%, and 19,102 unique rows beat buy and hold.

That gave us our first real candidate family:

  • MACD still chooses entries.
  • A trend filter decides whether entries are allowed.
  • The exit waits until the broader trend breaks.

This is already different from the textbook MACD crossover. The indicator is no longer being asked to do everything. It is one part of a larger rule.

The First Robustness Shock

Once BTC 4h looked promising, we tried to break it.

We tested BTC across multiple candle sizes. A candle size, or timeframe, is how much market time each chart bar represents. A 4h chart has one candle every four hours. A 1d chart has one candle per day.

If a strategy only works on one exact timeframe, that does not make it useless, but it does make it more suspicious.

The trend-filtered MACD branch held up best on BTC 4h:

  • BTCUSDT 4h median return: 281.03%
  • BTCUSDT 4h buy-and-hold: 164.36%
  • Rows above buy-and-hold: 13,050 / 13,500

But the same idea did not survive everywhere. BTC 2h was marginal-to-healthy. BTC 1h, 6h, 12h, and 1d were much less convincing. No exact BTC parameter tuple beat buy and hold across all tested BTC timeframes.

This was the second important finding:

We were not discovering one universal MACD setting. We were discovering an intraday trend-following family.

That shifted the research. Instead of asking for a single magic tuple, we started asking where the family had stable terrain.

Where the trend-filter idea looked strongest

Selected validation pockets from the 005-006 pass. Heat reflects how much of the tested grid beat buy-and-hold.

Market / timeframeMedian returnBuy-and-holdRows above B&H
BTCUSDT 4h281.03%164.36%13,050 / 13,500
ETHUSDT 2h359.03%209.22%13,005 / 13,500
XRPUSDT 2h805.38%534.13%10,777 / 13,500
XMRUSDT 4h41.01%-25.70%12,494 / 13,500
BNBUSDT 1h1,761.74%1,582.37%8,693 / 13,500

Some of those rows need caution. XRP and BNB had huge returns, but also very large reported drawdown. ETH 2h and XMR 4h were more useful validation cases because they showed the strategy could survive outside BTC without relying only on a high-beta bull market.

The Branches That Failed

At this point, we had a decent strategy family. The next question was whether another filter could clean it up.

We tested two ideas:

  1. A MACD threshold, which required MACD to be meaningfully above a minimum value before accepting a trade.
  2. A histogram confirmation, which tried to require extra evidence from the MACD histogram.

The threshold branch was tempting because it sometimes reduced trade count and drawdown. ETH 2h even produced a spectacular top row over 1,000%.

But robust research is not about the most exciting row. Across BTC and XMR especially, thresholding usually hurt median and P25 performance. It looked more like a risk throttle than an edge source.

The histogram diagnostic was even simpler: it did nothing. On BTC 2h and BTC 4h, each histogram mode produced identical results. Either the condition was redundant with the crossover, or it was not binding in the way we tested it.

So we dropped both as primary branches.

That is a good research outcome. A failed branch saves future time.

The Adaptation That Survived: A Time Stop

The most useful adaptation was a time stop.

A normal stop exits when price moves against you. A time stop exits when a trade has been open too long. In our script this was max_bars_in_trade, the maximum number of candles a position could stay open.

Why might this help? Because trend strategies can get stuck in stale trades. The original signal may have been valid, but after enough candles pass, the trade can become dead weight.

The time stop did not transform every market. BTC 4h improved the floor but did not find a new top. ETH 2h improved modestly. XMR 4h was the big surprise.

Final time-stop sweep summary for BTC, ETH, and XMR

Final time-stop runDeduped rowsBuy-and-holdBestMedianP25WorstRows above B&H
BTCUSDT 4h58,500164.36%636.34%272.62%225.42%60.33%96.0%
ETHUSDT 2h37,800209.22%890.42%373.02%315.44%127.54%98.9%
XMRUSDT 4h2,016-25.70%346.23%173.50%94.07%24.39%100.0%

XMR is worth pausing on. In the broader earlier test, XMR 4h already looked interesting because buy and hold was negative while the strategy was positive. But the focused time-stop grid was much stronger:

  • Median return rose to 173.50%.
  • P25 rose to 94.07%.
  • The worst tested row was still positive at 24.39%.
  • Every focused row beat buy and hold.

This is the closest thing we found to a robust plateau.

But it came with a caveat that only appeared later in the trade history: the fixed XMR candidate had no trades after 2023. That does not invalidate the sweep, but it makes the next research question obvious. We need to know whether the market stopped offering signals, or whether the chosen filter became too restrictive.

The Specialized Version

By the end of the research, the strategy no longer looked like “use MACD.”

It looked like this:

  1. Use MACD for long entries.
  2. Only allow entries when a longer trend filter agrees.
  3. Exit when the trend condition fails.
  4. Add a time stop so stale trades cannot linger forever.
  5. Specialize by market and timeframe instead of forcing one setting everywhere.

The candidate families we would freeze for further research are:

CandidateMarketTimeframeParameter regionWhy it survived
BTC alternate / top-tailBTCUSDT4hfast=8, slow=22, trend_len=210, signal=5, trend_mode=1, max_bars=40Highest BTC trade-history return, better spread across years.
BTC robustBTCUSDT4hfast=8-10, slow=20-24, trend_len=230, signal=5-7, longer max_barsLess dependent on one top row; healthier neighborhood.
ETH continuationETHUSDT2htrend_len=240, signal=5, often trend_mode=1Broad sweep strength, but path risk remains high.
XMR short-stopXMRUSDT4hfast=14-16, slow=36-40, trend_len=210-220, signal=9-13, max_bars=20Strongest final robustness grid.

Notice the language: candidate families, not production settings. That is deliberate. A fixed tuple can be useful for the next test, but the evidence came from neighborhoods.

What The Trade Histories Changed

Sweep results tell us where parameter regions are strong. Trade histories tell us how the money was made.

The trade-level review was sobering in the right way. The strategy was not a high-win-rate machine. It behaved like a trend-capture strategy: many small losses, a few large winners, and a lot of dependence on market regimes.

CandidateClosed tradesPortfolio returnWin rateProfit factorMax loss streakEvent-level max DDMain concern
BTC 4h primary49480.93%40.8%3.015-16.78%Too much profit from 2024.
BTC 4h alternate67578.87%43.3%2.646-23.96%Better spread, rougher path.
ETH 2h120558.77%31.7%1.6613-29.30%Low hit rate and tail dependence.
XMR 4h60333.98%66.7%2.492-22.16%No trades after 2023.

Profit factor compares gross winning dollars to gross losing dollars. A profit factor above 1 means winners exceeded losers. BTC primary had the best profit factor at 3.01, but it was also more concentrated in 2024.

The BTC alternate had a higher total return, 578.87%, and a better spread across multiple years. But it had deeper event-level drawdown and a longer loss streak.

ETH had the most trades, which is good for sample size, but the roughest path: only 31.7% win rate and a 13-trade losing streak.

XMR had the cleanest win/loss profile, but the absence of trades after 2023 is too important to ignore.

Yearly realized profit and loss for the final fixed candidates

The yearly view makes the tradeoff easier to see.

Candidate202120222023202420252026 partial
BTC 4h primary+5,074-1,762+7,399+35,764+4,990-3,371
BTC 4h alternate+9,880-3,955+15,859+29,008+5,991+1,104
ETH 2h+7,888+6,812+6,977+23,583+16,602-5,985
XMR 4h+12,847+14,066+6,441no tradesno tradesno trades

This is why we do not want to stop at the best sweep row. A strategy can look excellent in aggregate while still depending heavily on one regime.

What We Believe Now

After all of these tests, here is the honest version of the conclusion.

MACD by itself was not the discovery. The useful thing was a MACD-based trend-following family:

  • It worked best on intraday crypto charts, especially 2h and 4h.
  • It needed a broader trend filter.
  • It needed an exit that let winners breathe.
  • It benefited from a time stop in the right markets.
  • It did not become more robust from the threshold or histogram additions we tested.

The strongest final evidence was not “the top return was high.” It was that the narrowed time-stop sweeps lifted the floor:

  • BTC 4h final median: 272.62%
  • ETH 2h final median: 373.02%
  • XMR 4h final median: 173.50%

The most important caveats are just as clear:

  • The strategy is tail-dependent. A few large trend trades matter a lot.
  • It is not universal across timeframes.
  • ETH has meaningful path risk.
  • XMR needs a post-2023 signal investigation.
  • Sweep drawdown should be treated as relative because of the known export issue.

The Next Research Step

The right next step is not another massive parameter sweep.

At this stage, broad exploration has done its job. The better research path is to freeze a small candidate set and study behavior:

  1. Why did the XMR fixed candidate stop trading after 2023?
  2. Do BTC alternate and XMR complement each other by trade date?
  3. Does ETH add useful diversification, or only extra drawdown?
  4. Would a cooldown after losing exits improve path risk?
  5. Should a time-stop exit require a stricter re-entry condition before the strategy can buy again?

That is where this research becomes more like strategy engineering than indicator shopping.

The final lesson is not that MACD is magic. It is that old indicators can still be useful when they are forced through modern robustness checks: broad sweeps, market validation, trade-level inspection, and a willingness to discard branches that only look good at the top of the leaderboard.

MACD did not survive as a default crossover.

It survived as a specialized trend-capture component.