Indicators

MACD Indicator Explained for Automated Trading

How the MACD (Moving Average Convergence Divergence) works, what the signal line and histogram tell you, and how to build a MACD strategy in Setup.Cash.

By Setup.Cash TeamLast updated 2026-06-252 min read336 words

Featured image placeholder

/og/setup-cash-og.svg

MACD (Moving Average Convergence Divergence) is a trend-and-momentum indicator built from moving averages. It is popular because it captures both direction and momentum in one tool.

The Three Components

  1. MACD line = fast EMA − slow EMA (default 12 and 26). Measures momentum.
  2. Signal line = EMA of the MACD line (default 9). Smooths it.
  3. Histogram = MACD line − signal line. Shows momentum building or fading.

How to Read It

  • Bullish cross: MACD line crosses above the signal line — momentum turning up.
  • Bearish cross: MACD line crosses below the signal line — momentum turning down.
  • Zero line: MACD above zero is broadly bullish; below zero, bearish.
  • Histogram: growing bars mean accelerating momentum; shrinking bars mean it is fading.

A MACD Strategy in Setup.Cash

The classic setup is the signal-line crossover:

  • Long when MACD crosses above signal (ideally with MACD above zero).
  • Short when MACD crosses below signal (ideally below zero).

Add the MACD indicator in the builder, set a condition on the cross, and pair it with a stop and target. Or describe it to text-to-strategy: "MACD bullish cross on the Nasdaq 1h with ATR stop and 2R target."

Strengths and Weaknesses

  • Strength: captures trend changes and momentum shifts well in trending markets.
  • Weakness: whipsaws in choppy, sideways markets — crossovers fire repeatedly with no follow-through.

To reduce whipsaws, combine MACD with a higher-timeframe trend filter so you only take crosses in the direction of the bigger trend.

Tuning MACD

  • Faster settings (e.g., 8/17/9): more responsive, more signals.
  • Slower settings (e.g., 19/39/9): smoother, fewer but cleaner signals.

Test changes in a backtest — faster is not always better.

Build a Custom MACD

Want a MACD variant — say, a histogram-only momentum trigger, or MACD on a custom source? Build it in the Indicators Lab with the formula language, or generate it with AI.

MACD is a solid momentum tool, but like any indicator it describes the past. Confirm any MACD strategy with backtesting and paper trading before risking capital.

Not financial advice. Trading involves risk. Use backtesting and paper trading before risking real capital.

Related Posts

View all

Indicators

Moving Averages Explained: SMA, EMA, WMA, RMA

How simple, exponential, weighted, and smoothed moving averages differ, when to use each, and how to build a moving-average strategy in Setup.Cash.

2 min read · 401 words

Start here

Build your trading bot workflow with structure

Use Setup.Cash to create, backtest, and paper trade rule-based strategies without relying on guesswork. Not financial advice. Trading involves risk.