MACD Calculator

Instantly calculate Moving Average Convergence Divergence (MACD) components from your price data.

Fixed periods: 12 / 26 / 9. Paste 34–5,000 closes, oldest first, from one bar interval. No dates or headers; commas separate values, not thousands. EMAs use SMA seeds; no market data is fetched.

How to Use the MACD Calculator

  1. Collect Your Data: Gather the closing prices for the asset you want to analyze, ordered oldest to newest at one consistent interval.
  2. Enter Data: Paste the list of prices into the input field above. You can separate them by commas, spaces, or new lines.
  3. Calculate: Click the "Calculate MACD" button.
  4. Analyze Results: Review the generated table to see the MACD Line, Signal Line, and Histogram values for each period.

What is MACD?

Moving Average Convergence Divergence (MACD) is a trend-following momentum indicator that shows the relationship between two moving averages of a security's price. It was developed by Gerald Appel in the late 1970s.

The MACD is calculated by subtracting the 26-period Exponential Moving Average (EMA) from the 12-period EMA. The result of that calculation is the MACD line. A nine-period EMA of the MACD called the "signal line," is then plotted on top of the MACD line, which can function as a trigger for buy and sell signals.

Why This Matters for Traders

  • Trend Identification: MACD helps traders identify whether the bullish or bearish momentum is strengthening or weakening.
  • Signal Generation: Crossovers between the MACD line and the Signal line are often used as buy (bullish) or sell (bearish) signals.
  • Divergence Detection: When the price moves in the opposite direction of the MACD, it can signal a potential reversal.

Frequently Asked Questions

What does this calculator compute?

It uses fixed 12- and 26-period price EMAs, a 9-period EMA of their difference, and MACD minus signal for the histogram. Periods are observations, not necessarily days. These parameters are conventions, not an optimal setting recommendation.

How much price history is required?

Enter 34 to 5,000 finite closing prices, oldest first, from one consistent bar interval. This implementation seeds each EMA with a simple average: MACD first appears at observation 26, and signal/histogram at observation 34. Earlier cells show dashes.

Will these values exactly match my chart?

Not necessarily. Earlier history, EMA initialization, source prices, adjustments, moving-average type and bar interval can change values. This tool starts from only the prices you paste and does not fetch or validate market data.

Does a crossover establish a profitable trade?

No. Histogram sign describes the relationship between MACD and its signal average; a change of sign is a crossover. A crossover or divergence can fail or lag price and does not establish expected returns after costs.

Reference: TradingView MACD definitions and configurable moving-average types. This local calculator uses the specific EMA seed and history boundary stated above; it is not a TradingView parity test.

Draft and Review a MACD Strategy

Pineify can help draft Pine Script from your MACD rules. Review the code, test costs and execution assumptions, and inspect out-of-sample behavior. Generated code does not itself place broker orders.