MACD Calculator (Moving Average Convergence Divergence)

Upload or paste your prices and instantly compute MACD, signal line, and histogram with customizable EMA settings, automatic crossover detection, and an interactive chart.

MACD Calculator

Paste CSV or one value per line. Supported formats:

  • Date,Close
  • Date,Open,High,Low,Close
  • Just a list of closing prices

MACD chart

Top: price. Bottom: MACD (blue), signal (orange), histogram (green/red).

MACD values table

# Date / Index Price EMA fast EMA slow MACD Signal Histogram Signal
No data yet. Paste prices and click “Calculate MACD”.

What is MACD?

MACD (Moving Average Convergence Divergence) is a popular momentum indicator used in technical analysis. It compares a fast and a slow exponential moving average (EMA) of price to show when momentum is strengthening, weakening, or reversing.

The classic MACD settings are 12, 26, 9 on daily closing prices:

  • Fast EMA: 12-period EMA of price
  • Slow EMA: 26-period EMA of price
  • Signal line: 9-period EMA of the MACD line
  • Histogram: MACD − signal

MACD formula

1. Exponential Moving Average (EMA)

For period \(N\), smoothing factor: \[ \alpha = \frac{2}{N + 1} \]

EMA is updated recursively: \[ \text{EMA}_t = \alpha \cdot \text{Price}_t + (1 - \alpha)\cdot \text{EMA}_{t-1} \] The first EMA value is usually initialized with a simple moving average (SMA) of the first \(N\) prices.

2. MACD line

\[ \text{MACD}_t = \text{EMA}^{\text{fast}}_t - \text{EMA}^{\text{slow}}_t \]

3. Signal line

\[ \text{Signal}_t = \text{EMA}_{\text{signal period}}(\text{MACD}_t) \]

4. Histogram

\[ \text{Histogram}_t = \text{MACD}_t - \text{Signal}_t \]

How to use this MACD calculator

  1. Choose your MACD settings (fast, slow, and signal EMA periods). The default 12–26–9 is the most common.
  2. Paste your price data:
    • Either a simple list of closing prices, one per line
    • Or CSV with Date,Close
    • Or full OHLC data Date,Open,High,Low,Close
  3. Select the price type:
    • Close – standard MACD on closing prices
    • (High+Low)/2 – median price
    • (High+Low+Close)/3 – typical price
    • (Open+High+Low+Close)/4 – OHLC average
  4. Click “Calculate MACD”. The tool will:
    • Compute fast & slow EMAs
    • Compute MACD, signal line, and histogram
    • Highlight bullish/bearish crossovers
    • Plot price and MACD on an interactive chart

Interpreting MACD signals

1. MACD / signal line crossovers

  • Bullish crossover: MACD crosses above the signal line → potential buy signal.
  • Bearish crossover: MACD crosses below the signal line → potential sell signal.

Our calculator automatically labels each crossover in the table and in the summary panel so you can quickly see the latest signal.

2. Zero-line crossovers

  • MACD above zero: fast EMA > slow EMA → bullish bias.
  • MACD below zero: fast EMA < slow EMA → bearish bias.

Many traders use zero-line crossovers as trend confirmation, while using MACD/signal crossovers for timing.

3. MACD histogram

  • Histogram > 0: MACD above signal (bullish momentum).
  • Histogram < 0: MACD below signal (bearish momentum).
  • Rising histogram: momentum strengthening.
  • Falling histogram: momentum weakening.

4. Divergences

A bullish divergence occurs when price makes a lower low but MACD makes a higher low. A bearish divergence occurs when price makes a higher high but MACD makes a lower high. Divergences can warn of potential trend reversals, especially near key support/resistance zones.

Typical MACD trading strategies

Trend-following MACD strategy

  • Trade in the direction of the higher‑time‑frame trend (e.g., weekly or daily).
  • Use MACD/signal crossovers on a lower time frame for entries.
  • Confirm with price action (breakouts, pullbacks) and risk management.

MACD swing trading strategy

  1. Identify a clear trend.
  2. Wait for a counter‑trend pullback where MACD crosses against the main trend.
  3. Enter when MACD crosses back in the direction of the main trend.
  4. Use recent swing highs/lows for stop‑loss placement.

Limitations and best practices

  • MACD is a lagging indicator and will not catch exact tops or bottoms.
  • It can generate false signals in choppy, sideways markets.
  • Always combine MACD with other tools: support/resistance, volume, volatility, or other indicators.
  • Backtest your MACD settings and strategy on historical data before trading live.

FAQ

What are the best MACD settings?

The standard 12–26–9 settings are widely used and a good starting point. Short‑term traders may prefer faster settings (e.g., 5–13–6) for more responsive signals, while long‑term investors may use slower settings (e.g., 19–39–9) to filter noise. Our calculator lets you experiment with different combinations.

Which prices should I use for MACD?

Most platforms use closing prices. Some traders prefer median or typical price to smooth intraday noise. You can switch between these options in the “Price type” dropdown and instantly see how MACD changes.

Can MACD be used on any market or time frame?

Yes. MACD works on stocks, forex, crypto, indices, commodities, and on any time frame (from 1‑minute to monthly). However, the reliability of signals and the best parameter choices can vary by market and time frame, so testing is essential.

Is MACD enough on its own?

MACD is powerful but should not be used in isolation. It is best combined with:

  • Trend filters (moving averages, higher‑time‑frame trend)
  • Support and resistance levels
  • Volume or volatility indicators
  • Clear risk management rules (position sizing, stop‑loss, take‑profit)