MACD strategy: settings, signals and a backtest checklist

The MACD strategy is the most-used momentum system in retail trading — and the most over-tuned. This cheat sheet strips it to the three signals that matter, the settings worth testing, the filters that stop it whipsawing you, and the backtest steps that separate a real edge from a curve-fit fantasy.

On this page
  1. The three MACD signals
  2. Settings that matter
  3. Filters that cut whipsaw
  4. Backtest checklist
  5. FAQ

The three signals every MACD strategy uses

MACD (Moving Average Convergence Divergence) is built from two exponential moving averages and a signal line. For the full mechanics, see our deeper MACD trading strategy guide; here we focus on turning it into rules you can test. Three signals do the work:

buy

Settings that actually matter

The default 12/26/9 is a convention, not a law of markets. Faster settings (e.g. 8/17/9) react sooner but whipsaw more; slower settings (e.g. 19/39/9) cut noise but lag. The honest truth is that no single setting wins everywhere — and chasing the "best" setting is exactly how people overfit. Test two or three settings across multiple symbols and timeframes, and prefer the one that is least sensitive to small parameter changes, not the one with the single highest return.

Filters that cut the whipsaw

A raw crossover bot loses money in ranges. Two filters help most: (1) only take crossovers in the direction of a longer trend — for example, longs only when price is above its 200-period EMA — and (2) require the histogram to exceed a small threshold so micro-crossovers are ignored. Both are forms of regime filtering, the same idea that rescues the EMA crossover strategy from sideways markets.

The backtest checklist

Before trusting any MACD rule, run it through the strategy backtester and confirm: realistic fees and slippage are included; the result holds out-of-sample (not just on the data you tuned on); the equity curve is not driven by two lucky trades; and the drawdown is survivable. A MACD bot that looks brilliant only on 12/26/9 and falls apart at 11/25/9 has no edge — it has a coincidence. Learn the trap in overfitting in trading.

Not financial advice. This content is educational. Automated and algorithmic trading carries a real risk of financial loss. Never trade money you cannot afford to lose. Review the SEC investor.gov and CFTC resources before trading.

Frequently asked questions

What are the best MACD settings?

There is no universally best setting; 12/26/9 is the convention. Faster settings react sooner but whipsaw more, slower ones lag. The most robust choice is one that performs similarly across nearby parameters and multiple symbols, not the single highest-returning one in a backtest.

Does the MACD strategy work?

MACD can add value as a trend-momentum filter, but a raw crossover bot loses money in range-bound markets because of whipsaw. Adding a trend filter and a histogram threshold, then validating out-of-sample, is what makes it usable.

Is MACD better than RSI?

They measure different things — MACD tracks trend momentum, RSI tracks overbought/oversold conditions. Many traders combine them. Neither is reliable alone without filters and proper backtesting.

Can I automate a MACD bot?

Yes. The crossover logic is simple to code, and platforms like TradingView (via Pine Script and webhooks) or ccxt-based Python bots execute it. The hard part is risk management and avoiding overfit settings, not the signal itself.

MB

Mustafa Bilgic

Algorithmic trading practitioner · Founder, AITradingBot.us

Mustafa builds and backtests automated trading systems and writes about them without the hype. Every tool on this site is free and runs entirely in your browser.