MACD Calculator — Moving Average Crossover
Quickly compute macd with accurate formulas. See amortization schedules, growth projections, and side-by-side comparisons.
MACD Calculator — Moving Average Crossover
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser — no data is sent to any server.
Formula: MACD = EMA(fast) - EMA(slow) | Signal = EMA(MACD, signal) | Histogram = MACD - Signal
Worked example — MACD: -0.4782 | Signal: -0.2146 | Histogram: -0.2636 (Bearish)
Formula
MACD = EMA(fast) - EMA(slow) | Signal = EMA(MACD, signal) | Histogram = MACD - Signal
The MACD line is the difference between a fast EMA (typically 12 periods) and a slow EMA (typically 26 periods). The signal line is an EMA of the MACD line (typically 9 periods). The histogram is the difference between the MACD and signal lines, showing momentum direction and strength.
Worked Examples
Example 1: Standard 12/26/9 MACD on the Loaded Series
Problem:The price box loads with 35 daily closes. With the standard 12/26/9 settings, what do the MACD line, signal line and histogram read on the final bar?
Solution:1. Calculate the 12-period EMA of the closes 2. Calculate the 26-period EMA of the closes 3. MACD Line = 12-EMA - 26-EMA, so the first value needs 26 closes 4. Signal Line = 9-period EMA of the MACD Line, which needs 8 further bars, or 34 closes in total 5. Histogram = MACD Line - Signal Line On this series the MACD line sits below the signal line, so the reading is bearish.
Result:MACD: -0.4782 | Signal: -0.2146 | Histogram: -0.2636 (Bearish)
Example 2: Fast Settings for Day Trading
Problem:Use MACD settings 8/17/9 on intraday price data to detect short-term momentum shifts.
Solution:1. Calculate 8-period EMA (fast response) 2. Calculate 17-period EMA (slower baseline) 3. MACD Line = 8-EMA - 17-EMA 4. Signal Line = 9-period EMA of MACD 5. Analyze histogram direction for momentum Faster settings catch momentum changes earlier but may produce more false signals
Result:Faster settings generate signals 2-3 bars earlier than standard settings
Frequently Asked Questions
What is MACD and how does it work in trading?
MACD stands for Moving Average Convergence Divergence, and it is one of the most widely used technical analysis indicators in trading. Developed by Gerald Appel in the late 1970s, MACD measures the relationship between two exponential moving averages of a security price. The indicator consists of three components: the MACD line (difference between the fast and slow EMA), the signal line (an EMA of the MACD line), and the histogram (the difference between MACD and signal lines). Traders use MACD to identify changes in the strength, direction, momentum, and duration of a trend in a stock or other financial instrument price.
How do you interpret MACD crossover signals?
MACD crossover signals occur when the MACD line crosses above or below the signal line. A bullish crossover happens when the MACD line crosses above the signal line, suggesting upward momentum and a potential buying opportunity. A bearish crossover occurs when the MACD line crosses below the signal line, indicating downward momentum and a potential selling signal. The strength of the signal is often judged by where the crossover occurs relative to the zero line. Crossovers that occur far from zero tend to produce more reliable signals than those near the zero line. Many traders wait for confirmation from price action or volume before acting on crossover signals alone.
What do the MACD histogram bars indicate?
The MACD histogram visually represents the difference between the MACD line and the signal line, making it easier to spot changes in momentum. When the histogram bars are positive and growing taller, bullish momentum is increasing. When positive bars start shrinking, it suggests bullish momentum is weakening even though the trend may still be upward. Similarly, negative and growing bars indicate strengthening bearish momentum, while shrinking negative bars suggest bearish pressure is easing. The transition from positive to negative or vice versa corresponds to a MACD crossover signal. Traders often watch for histogram divergences with price as an early warning of potential trend reversals.
What are the best MACD settings for different trading styles?
The default MACD settings of twelve, twenty-six, and nine periods work well for many situations, but different trading styles benefit from adjusted parameters. Day traders often use faster settings like eight, seventeen, and nine or even five, thirteen, and one to capture shorter-term momentum shifts in intraday price action. Swing traders may stick with the standard twelve, twenty-six, nine settings or slightly slower configurations. Long-term position traders and investors might use twenty-four, fifty-two, and nine to filter out short-term noise and focus on major trend changes. Faster settings produce more signals but more false positives, while slower settings generate fewer but generally more reliable trading signals.
What is MACD divergence and why is it important?
MACD divergence occurs when the price of a security moves in the opposite direction of the MACD indicator, signaling a potential trend reversal. Bullish divergence happens when price makes a lower low but the MACD makes a higher low, suggesting that downward momentum is weakening and a reversal upward may be imminent. Bearish divergence occurs when price makes a higher high but the MACD makes a lower high, indicating that upward momentum is fading despite continuing price increases. Divergence signals are among the most powerful in technical analysis, but they should be confirmed with other indicators or price pattern analysis because divergence can persist for extended periods before a reversal actually occurs.
Why does MACD use exponential moving averages instead of simple moving averages?
An exponential moving average weights the most recent closes more heavily than older ones, so it turns faster than a simple moving average of the same length. Because MACD exists to flag shifts in momentum, that responsiveness matters more than the smoothness an SMA offers. The trade-off is that an EMA never fully discards old data, and its quicker reaction makes the MACD line noisier during choppy, sideways price action.
What does it mean when the MACD line crosses the zero line?
The zero line, also called the centerline, is the point where the fast and slow EMAs are equal. A cross above zero means the 12-period EMA has moved above the 26-period EMA, confirming that shorter-term prices have overtaken the longer-term average. A cross below zero says the reverse. Centerline crosses lag signal-line crosses by design, so most traders treat them as trend confirmation rather than as entry triggers.
How is the EMA smoothing multiplier derived from each period setting?
Every EMA here uses a smoothing multiplier of 2 divided by (period + 1). A 12-period EMA therefore weights the newest close at about 0.1538, a 26-period EMA at about 0.0741, and the 9-period signal line at exactly 0.2. Each new value equals the previous EMA plus that multiplier times the gap between the current price and the previous EMA, which is why longer periods respond more slowly.
How many closing prices are needed before the signal line and histogram appear?
The slow EMA must be seeded before anything else can be computed, so with default settings the MACD line needs at least 26 closes. The signal line is a 9-period EMA of the MACD line, requiring 8 further bars on top of that, or 34 closes in total, before the first histogram value exists. Supply fewer closes than the slow period and the calculator returns no result at all.
What is the difference between MACD and RSI as momentum indicators?
RSI is a bounded oscillator that rescales average gains against average losses onto a 0 to 100 range, so it measures how stretched a move has become. MACD is unbounded and expressed in the instrument's own price units, because it is simply the gap between two EMAs. That makes MACD better at describing trend direction and whether momentum is widening or narrowing, while RSI is better at flagging overbought and oversold extremes.
References
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer · Editorial policy
Related Calculators
🧮Moving Average Calculator
Calculate moving average with inputs, formulas, and instant results.
🧮Average Daily Range Calculator
Calculate average daily range with inputs, formulas, and instant results.
🧮Monthly Trading Statistics Calculator
Calculate monthly trading statistics: win rate, average RR, expectancy, and profit factor.
🧮ATR Calculator — Average True Range
Calculate atr with inputs, formulas, and instant results.
🧮VWAP Calculator — Volume Weighted Price
Calculate Volume Weighted Average Price for intraday trading support and resistance levels.
🧮ADX Calculator — Trend Strength Indicator
Calculate the Average Directional Index to measure trend strength regardless of direction.
🧮Pip Calculator
Calculate pip with inputs, formulas, and instant results.
🧮Forex Margin Calculator
Calculate forex margin with inputs, formulas, and instant results.