Free trial
Menu
Learn guide

MACD Indicator Explained: Lines, Histogram and Settings

The MACD indicator, short for Moving Average Convergence Divergence, tracks the gap between two exponential moving averages of the price to show the direction and strength of momentum. Gerald Appel developed it in the late 1970s, and the standard settings are 12, 26 and 9. It has three parts: the MACD line, a signal line and a histogram. When the faster average pulls away from the slower one, momentum is building; when the two come back together, it is fading. That is the convergence and divergence in the name.

QuantPower Research · Updated 3 Nov 2026 · 17 min read

This guide calculates MACD step by step on a model Nifty series, explains how to read the lines, the zero line and the histogram, compares settings, and covers divergence, the problem of measuring MACD in points, intraday use and the indicator's limits.

Key point
MACD confirms turns after they happen. On the model series below, the bearish signal-line cross came 5 sessions and 561.95 points after the high, and the bullish cross 8 sessions and 640.50 points after the low.

Key takeaways

  • MACD line = 12-period EMA − 26-period EMA. Signal line = 9-period EMA of the MACD line. Histogram = MACD line − signal line.
  • The MACD line is above zero when the 12-period EMA is above the 26-period EMA, and it crosses the signal line when its own momentum changes direction.
  • The histogram turns before the lines cross. On the model series it reached its lowest reading on the day of the price low and turned up the next session, seven sessions before the bullish cross.
  • MACD is measured in points, so its size depends on the price level. Values cannot be compared across instruments; the percentage price oscillator divides by the slower average to fix that.
  • Faster settings give earlier and more frequent signals; slower settings give fewer and later ones. No setting removes the lag.
  • Read MACD on the index or futures chart and trade options on that view. An option's own price chart mixes in time decay.

The model Nifty series

Every number on this page comes from one model series of 72 daily closes, a seeded random walk that is not market data. It is the same series used in the guides to RSI and moving averages.

PhaseSessionsClose at the startClose at the end
Dip and slow riseDays 1 to 2524,800.0024,920.15
Rally to the highDays 26 to 3224,959.4525,500.00
Fall to the lowDays 33 to 4425,473.0024,158.55
RecoveryDays 45 to 7224,181.2025,867.60

The high is 25,500.00 on day 32 and the low 24,158.55 on day 44, a fall of 1,341.45 points or 5.26%.

How MACD is calculated

Formula
MACD line = 12-period EMA − 26-period EMA. Signal line = 9-period EMA of the MACD line. Histogram = MACD line − signal line.

Each exponential moving average follows the usual rule: EMA today = close × k + EMA yesterday × (1 − k), with k = 2 ÷ (N + 1). The multipliers are 0.1538 for the 12-period EMA, 0.0741 for the 26-period EMA and 0.2 for the 9-period signal line. An EMA puts the most weight on the latest closes, so the 12-period EMA reacts faster than the 26-period one, and the gap between them widens when the price moves quickly.

The parts appear in stages, because each needs its own history:

ValueFirst availableStarting value on the model series
12-period EMADay 12, the average of the first 12 closes24,657.23
26-period EMADay 26, the average of the first 26 closes24,746.13
MACD lineDay 2624,841.89 − 24,746.13 = 95.76
Signal lineDay 34, the average of the first 9 MACD values159.23
HistogramDay 34214.62 − 159.23 = 55.39

MACD with standard settings needs 34 closes before all three parts exist, and many more before the values stop depending on where the calculation started.

A worked example: the bullish cross on day 52

DayClose12-period EMA26-period EMAMACD lineSignal lineHistogram
5024,505.4524,459.9324,629.59−169.67−134.56−35.11
5124,628.9524,485.9324,629.55−143.62−136.37−7.25
5224,799.0524,534.1024,642.10−108.00−130.70+22.70
5324,898.0024,590.0924,661.06−70.97−118.75+47.78
Example
On day 52 Nifty closes 170.10 points higher at 24,799.05. The 12-period EMA becomes 24,799.05 × 2 ÷ 13 + 24,485.93 × 11 ÷ 13 = 24,534.10, and the 26-period EMA 24,799.05 × 2 ÷ 27 + 24,629.55 × 25 ÷ 27 = 24,642.10. The MACD line is 24,534.10 − 24,642.10 = −108.00. The signal line becomes −108.00 × 0.2 + (−136.37) × 0.8 = −130.70. The histogram is −108.00 − (−130.70) = +22.70, its first positive reading since day 36: the MACD line has crossed above its signal line.

The MACD line was still below zero on day 52, so the 12-period EMA was still below the 26-period EMA. The cross above the signal line showed that the gap between them was closing fast. The MACD line crossed zero four sessions later, on day 56, at +2.50.

The three parts of MACD

PartWhat it showsWhat traders watch
MACD lineThe gap between the fast and slow EMAs, in pointsIts direction, and crosses of zero
Signal lineA smoothed version of the MACD lineCrosses with the MACD line
HistogramThe gap between the MACD line and the signal lineIts sign, and whether the bars are growing or shrinking

The MACD line and the zero line

The MACD line is positive when the 12-period EMA is above the 26-period EMA, which happens when recent closes have been higher than older ones. A cross above zero is the moment the fast EMA moves above the slow one, the same event as a 12/26 EMA crossover. A cross below zero is the reverse. The zero line is therefore a slow trend signal: on the model series, MACD crossed below zero on day 41, 9 sessions after the high, and above it on day 56, 12 sessions after the low.

The signal line

The signal line is a 9-period EMA of the MACD line, so it trails the MACD line. When the MACD line crosses above it, the gap between the averages is growing faster than its recent average; when it crosses below, the gap is shrinking. Signal-line crosses come sooner than zero-line crosses and more often.

Reading MACD

SignalWhat it showsUsual reading
MACD crosses above the signal lineMomentum turning upBullish
MACD crosses below the signal lineMomentum turning downBearish
MACD crosses above zeroThe 12-period EMA moves above the 26-period EMAUptrend confirmed
MACD crosses below zeroThe 12-period EMA moves below the 26-period EMADowntrend confirmed
Histogram bars growingMomentum increasingThe move is strengthening
Histogram bars shrinkingMomentum fadingA signal-line cross may follow

Crosses above and below zero

Where a signal-line cross happens changes how traders read it.

CrossUsual readingOn the model series
Bullish, with MACD above zeroAn uptrend resuming after a pauseNone
Bullish, with MACD below zeroA fall slowing: the weaker kind of buy signalDay 52, at −108.00
Bearish, with MACD above zeroAn uptrend slowing: the weaker kind of sell signalDay 37, at 141.09
Bearish, with MACD below zeroA downtrend resuming after a pauseNone

Both crosses on the model series were of the weaker kind, because each came soon after a turn, before the averages had crossed. The bullish cross on day 52 was followed by a zero-line cross four sessions later; the bearish cross on day 37 by one four sessions after it, on day 41. A rule that waits for both signals trades later and less often, and avoids crosses that are not followed through.

The sequence on the model series

MACD (12, 26, 9) on the model Nifty series: the lines crossed down 5 sessions after the high and up 8 sessions after the low
EventDayCloseReadingSessions after the turn
Price high3225,500.00
MACD line peaks3425,432.65MACD 214.622
Bearish signal-line cross3724,938.05Histogram −22.955
MACD crosses below zero4124,483.65MACD −23.289
Price low4424,158.55Histogram −129.41, its lowest
Histogram turns up4524,181.20Histogram −126.781
MACD line bottoms4824,272.45MACD −190.774
Bullish signal-line cross5224,799.05Histogram +22.708
MACD crosses above zero5624,933.90MACD +2.5012

The order is the same at both turns: the price turns first, then the histogram, then the MACD line, then the signal-line cross, then the zero-line cross. Each step is later and more reliable than the one before. The bearish cross came 561.95 points below the high and the zero-line cross 1,016.35 points below it; the bullish cross came 640.50 points above the low and the zero-line cross 775.35 points above it.

The MACD histogram

The MACD histogram is the MACD line minus the signal line, drawn as bars above and below zero. Thomas Aspray added it in 1986 to give earlier warning of crosses. Because the signal line is an average of the MACD line, the histogram measures how fast the MACD line is moving away from its own average. It changes sign exactly when the two lines cross.

On the model series the histogram's lowest bar, −129.41, came on day 44, the day of the price low. From day 45 the bars shrank for seven sessions in a row, from −126.78 to −7.25, before turning positive on day 52. A trader watching the histogram saw momentum stop falling seven sessions before the lines crossed.

Two readings of the histogram are common:

  • Shrinking bars. Several shrinking bars in a row show momentum fading. Some traders tighten a trailing stop when the histogram shrinks for three bars in a row, rather than waiting for the cross.
  • Peaks and troughs. A histogram trough that is shallower than the previous one, while the price makes a lower low, is an early form of divergence.

The histogram is also the noisiest part of MACD. It turns often in sideways markets, and a single shrinking bar means little.

Reading the model series with MACD

PhaseWhat MACD didWhat it said
Days 26 to 33The MACD line rose from 95.76 to 212.70; no signal line yetMomentum building in the rally
Days 34 to 36The histogram shrank from 55.39 to 8.08 while the price stayed near the highMomentum fading at the top
Days 37 to 51The histogram stayed negative, lowest at −129.41 on day 44; the MACD line was below zero from day 41, lowest at −190.77 on day 48The fall, then its slowing
Days 52 to 72The histogram stayed positive, between 22.70 and 82.99; the MACD line was above zero from day 56 and ended at 236.92The recovery

MACD is sensitive to single large closes. On day 52 the 170.10-point rise moved the MACD line by 35.62 points, from −143.62 to −108.00, and the histogram by 29.95, enough to turn it positive. A day of the same size in the middle of a calm trend moves the lines just as much, which is one reason a single bar or a single cross carries little weight on its own.

MACD settings

SettingCharacterCommon use
(12, 26, 9)The standardDaily and intraday charts
(8, 17, 9)FasterShort-term trading, earlier signals
(5, 35, 5)Wide gap between the averages, fast signal lineMore sensitive to turns
(19, 39, 9)SlowerLonger trends, fewer signals

On the model series the settings gave these signals:

SettingSignal line fromSignal-line crossesZero-line crosses
(12, 26, 9)Day 34Bearish day 37, bullish day 52Down day 41, up day 56
(8, 17, 9)Day 25Bullish day 26, bearish day 36, bullish day 50Down day 39, up day 54
(5, 35, 5)Day 39Bullish day 49Down day 40, up day 53
(19, 39, 9)Day 47Bullish day 54Down day 44, up day 57

The faster (8, 17, 9) setting crossed one session earlier at the top and two sessions earlier at the bottom, and added a cross on day 26 at the start of the rally. The slower settings need more history: (19, 39, 9) had no signal line until day 47, after the low. The (5, 35, 5) setting crossed zero earliest after the low, on day 53, because its 5-period fast average reacts quickly.

There is no best setting. A setting tuned until it catches the past turns of one instrument usually catches fewer on the next stretch of data. Choose a setting, test it with costs over several years and on more than one instrument, and keep it unless something changes in how the market trades, not because of the last few signals.

MACD divergence

MACD divergence is a disagreement between the price and the MACD line or histogram. In a bearish divergence the price makes a higher high while MACD makes a lower high: the fast average is pulling away from the slow one less strongly than on the last push. In a bullish divergence the price makes a lower low while MACD makes a higher low.

Divergence warns that momentum is fading; it does not time the turn. A trend can produce two or three divergences before it reverses, and some never reverse at all. Traders who trade divergences wait for a price trigger, such as a break of the last swing low or high, or for a signal-line cross, and set a stop beyond the extreme.

MACD has no upper or lower bound, which makes its divergences different from those on RSI. A lower MACD peak can come simply from a slower, steadier rise in which the averages stay closer together, without any loss of trend. Judging two MACD peaks also depends on the price level: a peak of 200 points means less at 26,000 than at 20,000. Divergences on the histogram turn up more often, and give more false warnings, than divergences on the MACD line.

MACD is measured in points

The MACD line is a difference between two prices, so it is measured in the instrument's own points or rupees, and its size depends on the price level and volatility.

InstrumentLevelThe same 0.94% gap between the averages
Nifty25,193About 237 points
Bank Nifty56,000About 527 points
A stock₹1,400About ₹13

A MACD of 237 is large for Nifty and small for Bank Nifty, and it is not comparable with a stock's ₹13. Even on one index, a MACD reading from five years ago, when the index stood lower, is not comparable with today's.

Formula
Percentage price oscillator (PPO) = (12-period EMA − 26-period EMA) ÷ 26-period EMA × 100

The PPO divides the gap by the slower average and states it in percent. On day 72 of the model series it is 236.92 ÷ 25,192.47 × 100 = 0.94%. Use the PPO to compare momentum across stocks, across indices or across long periods. Zero-line crosses of the PPO come on the same days as MACD's, because dividing by the slow average does not change the sign of the gap; signal-line crosses can differ by a session when the price level changes a lot.

MACD on intraday charts

The NSE equity and F&O session runs from 9:15 am to 3:30 pm, 375 minutes, so the standard settings cover very different spans on different charts:

Chart12 periods26 periodsValues before the first histogram bar
5-minute60 minutes130 minutes34 candles, about 2 hours 50 minutes
15-minute3 hours6½ hours, just over one session34 candles, about 1⅓ sessions
60-minuteAbout 2 sessionsAbout 4 sessions34 candles, about 5 sessions
DailyAbout 2½ weeksAbout 5 weeks34 sessions
WeeklyAbout 3 monthsAbout 6 months34 weeks, about 8 months

On weekly charts signals are rare, a few a year, so positional traders often take direction from the weekly MACD and timing from the daily one.

Two points matter on Indian indices:

  • The opening gap. When Nifty opens far from the previous close, both EMAs jump at once, the fast one more, and the MACD line can leap in the first candle. Some intraday traders ignore the first 15 minutes of signals.
  • Continuity across sessions. Platforms carry the EMAs from one session to the next, so the morning's MACD still reflects the previous afternoon. That is useful for direction and less so for the exact level of the first readings.

MACD on Nifty, Bank Nifty, stocks and options

  • Index or futures. Read MACD on the Nifty or Bank Nifty index, or on near-month futures. A continuous futures chart jumps at each monthly roll unless the data is adjusted, and the jump passes into both EMAs.
  • Options. An option's price falls with time decay and moves with implied volatility, so MACD on the option's own chart mostly tracks decay. Read MACD on the underlying and trade the option on that view.
  • Stocks. Use adjusted data around splits and bonus issues, or the averages will show a false collapse. Compare momentum across stocks with the PPO, not with MACD.

MACD with other tools

Pair MACD withWhy
A trend filter, such as the 200-day averageTakes bullish crosses only in a long-term uptrend
ADXSkips crossovers when the market is not trending, where MACD whipsaws
RSIMACD gives the direction of momentum, RSI its extremes
Support and resistanceA cross at a known level carries more weight than one in mid-range
A volatility measure such as ATRSets stops in points that suit the market's movement

MACD compared with RSI

MACDRSI
Built fromTwo exponential moving averagesAverage gains and average losses
RangeUnbounded, in points0 to 100
Comparable across instrumentsNo; use the PPOYes
Best atDirection and changes of momentumOverbought and oversold readings, ranges in trends
WeaknessLate signals and whipsaws in rangesStays at extremes in strong trends
Model series, after the highBearish cross on day 37Crossed below 50 on day 37
Model series, after the lowBullish cross on day 52Crossed above 50 on day 52

On the model series MACD's signal-line crosses and RSI's crosses of 50 fell on the same sessions. Both are built from the same closes, and in a clean trend change they usually agree; they disagree most in sideways markets and in strong trends.

A short MACD reading routine

  1. Check the zero line. Above zero, the 12-period EMA is above the 26-period EMA and the medium-term trend is up; below zero, it is down.
  2. Check the signal line. A cross shows the latest change in momentum. Note whether it came above or below zero.
  3. Read the histogram. Growing bars mean momentum is building; several shrinking bars in a row mean it is fading, often before the next cross.
  4. Look for disagreement. A higher high in price with a lower MACD peak, or a lower low with a higher MACD trough, warns that the move is losing force.
  5. Confirm with the price. A cross or a divergence is a reason to look, not to trade. A break of a swing high or low, a known level or a trend filter decides whether there is a trade.
  6. Check the history. On a new chart, make sure at least 34 periods, and preferably several times more, sit behind the first reading you use.

The limits of MACD

  • It lags. It is built from moving averages of past closes. On the model series its signal-line crosses came 5 and 8 sessions after the turns.
  • It whipsaws in ranges. In a sideways market the lines cross back and forth, and each cross is a false signal.
  • It is measured in points. Its values cannot be compared across instruments or across long periods of one instrument.
  • Gaps distort it. A large opening gap moves both EMAs at once and can jolt the MACD line on intraday charts.
  • It is not a forecast. MACD describes momentum that has already happened.

Common mistakes

  • Trading every signal-line cross. In a sideways market most crosses are noise. Use a trend or range filter.
  • Comparing MACD values across stocks. Use the PPO for comparisons.
  • Reading MACD on an option's chart. Time decay dominates the option's price.
  • Ignoring where the cross happens. A bullish cross far below zero in a downtrend is weaker than one near or above zero.
  • Using too little history. With standard settings the histogram needs 34 closes to start and many more to settle.
  • Changing the settings after each loss. A setting fitted to recent signals rarely holds on the next ones.

Using MACD in a trading strategy

MACD appears in four common roles:

  • Trend following. Enter on a bullish signal-line cross when MACD is above zero and exit on the opposite cross, or on the zero-line cross for slower trading. Rules, worked numbers and exits are set out in the MACD trend following strategy.
  • Filter. Take long setups from another strategy only when MACD is above zero, or only when the histogram is positive.
  • Exit warning. Tighten a trailing stop when the histogram shrinks for several bars in a row.
  • Regime check. Combine MACD with ADX or a long moving average to skip crossovers when the market is not trending.

MACD is one of several indicators built from moving averages; the technical indicators guide compares it with the others used in rule-based strategies.

MACD in QuantPower

In the option strategy builder, MACD on the underlying can be used in indicator-based entry and exit conditions, together with price levels, moving averages and time windows, and the trade can be an option, a spread or a futures position. Test the rules in backtesting on five years of 1-minute data, then run them on live prices in paper trading before deploying them through your broker.

Start your free trial

Connect your broker, build a strategy and test it on paper before a single live order goes out.

Frequently asked questions

How is MACD calculated?

Subtract the 26-period EMA of the closes from the 12-period EMA to get the MACD line. Take a 9-period EMA of the MACD line for the signal line, and subtract the signal line from the MACD line for the histogram. On day 52 of the model series that gives −108.00, −130.70 and +22.70.

What does MACD above zero mean?

That the 12-period EMA is above the 26-period EMA, so recent closes have been higher than older ones. A cross above zero is the same event as the 12-period EMA crossing above the 26-period EMA.

What is the MACD histogram?

The MACD line minus the signal line, drawn as bars. It is positive when the MACD line is above the signal line, and its bars shrink when momentum fades, often several sessions before the lines cross.

Can MACD be compared across stocks?

Not directly, because it is measured in points and depends on the price level. The percentage price oscillator divides the gap between the averages by the slower average, which makes the values comparable.

Can MACD be used for options?

Read MACD on the Nifty or Bank Nifty chart, or on the futures, and trade options on that view. MACD on an option's own price chart mostly reflects time decay and is less useful.

What is MACD divergence?

A disagreement between the price and MACD, such as a higher high in price with a lower high in the MACD line. It warns that momentum is fading and is usually traded only after a price trigger or a signal-line cross.

Sources

  • Appel, G. (2005). Technical Analysis: Power Tools for Active Investors. FT Prentice Hall
  • Aspray, T. (1986). Fine-tuning the MACD. Technical Analysis of Stocks & Commodities, 4(4)
  • Murphy, J. J. (1999). Technical Analysis of the Financial Markets. New York Institute of Finance
  • NSE: trading hours for the equity and equity derivatives segments
Figures and charts on this page use a model Nifty series, not market data. Trading involves substantial risk, and this guide is for education, not investment advice.