The MACD indicator compares two moving averages of a chosen price series. Its main line is the faster average minus the slower average. A signal line smooths that difference, and the histogram measures the gap between the main line and the signal line.
Those are three related series with different meanings. A positive histogram does not necessarily mean the main MACD line is positive, and a rising histogram does not prove that the latest price rose. Once the arithmetic is visible, those apparently conflicting descriptions become much easier to read.
This guide focuses on calculation and interpretation. The short settings below make the example easy to reproduce; they are not suggested trading parameters. Every price is hypothetical, and no line crossing is presented as an instruction or prediction.
Read the MACD indicator’s three components
MACD stands for moving average convergence divergence. Under a common exponential version, calculate a fast EMA and a slow EMA from the same source. Subtract the slow value from the fast value to obtain MACD. Then apply another EMA to the MACD series to obtain its signal.
The histogram is MACD minus signal. These formulas are shown in TradingView’s MACD documentation, which also permits different moving-average types through its settings. A label that says MACD therefore still needs its parameters and averaging choices.
Fidelity’s MACD guide describes the familiar 12-period and 26-period EMA difference with a nine-period EMA signal. The periods refer to input observations. Twelve hourly closes and twelve daily closes are different samples, even though both use the number twelve.
All three components retain the price unit. If the input is quoted in rupees, a MACD of 2 represents a two-rupee difference between averages. It is not a 2% return. Unlike RSI, MACD does not have fixed boundaries at 0 and 100.
Set up a fully specified MACD indicator example
Use fast length 3, slow length 5 and signal length 3. With alpha = 2/(n + 1), the respective coefficients are 1/2, 1/3 and 1/2. Use completed close prices and no display offset.
For the starting state, imagine thirty earlier closes all equal to 100. Initialise each price EMA with its length-specific SMA and the signal EMA with its own three-value SMA after MACD becomes available. Because the entire warm-up is constant, the fast EMA is 100, the slow EMA is 100, MACD is 0 and the signal is 0 before the example begins.
Now supply eight new closes: 106, 106, 100, 100, 100, 100, 100 and 100. The first two observations form a temporary step, followed by six unchanged closes back at 100. This sequence is useful because it separates a new price change from an indicator’s continuing adjustment.
TradingView’s EMA reference provides the recursive update: new EMA = alpha × new input + (1 − alpha) × previous EMA. Apply that formula separately to the two price averages, then to the resulting MACD value for the signal.
Do not round the intermediate states before the next update. Keep several decimals or exact fractions in the calculation and round only the display. Repeated early rounding can make a later histogram look different near zero.
Calculate the first three observations
At observation 1, the close is 106. Fast EMA = 0.5 × 106 + 0.5 × 100 = 103. Slow EMA = one-third × 106 + two-thirds × 100 = 102. MACD is 103 − 102 = 1.
The signal updates to 0.5 × 1 + 0.5 × 0 = 0.5. The histogram is 1 − 0.5 = 0.5. The two positive numbers answer separate questions: the fast price average exceeds the slow price average, and MACD exceeds its smoothed signal.
At observation 2, the close is still 106. Fast EMA becomes 104.5 and slow EMA becomes approximately 103.3333. MACD becomes 1.1667. The signal becomes 0.8333, so the histogram falls to 0.3333 even though MACD has risen from 1 to 1.1667.
The gap between MACD and signal narrowed because the signal also rose. A smaller positive histogram therefore cannot be translated directly into “price fell” or “MACD fell.” Neither happened in this step: price stayed unchanged and MACD increased.
At observation 3, the close returns to 100. Fast EMA becomes 102.25 and slow EMA becomes 102.2222. MACD remains slightly positive at 0.0278, while the signal is 0.4306. The histogram is approximately −0.4028.
This is the reverse of a common reading error: a negative histogram can coexist with a positive MACD line. It says MACD is below the signal. It does not say the fast price average has already fallen below the slow price average.
Follow the same calculation through a flat price
Continue with closes of 100. Rounded to four decimals, the remaining readings are:
- Observation 4: MACD −0.3565; signal 0.0370; histogram −0.3935
- Observation 5: MACD −0.4252; signal −0.1941; histogram −0.2311
- Observation 6: MACD −0.3772; signal −0.2856; histogram −0.0916
- Observation 7: MACD −0.2983; signal −0.2920; histogram −0.0064
- Observation 8: MACD −0.2223; signal −0.2572; histogram 0.0348
By observation 8 the histogram is positive while MACD is negative. The fast average is still below the slow average, but their difference is now above its signal. The price has been 100 for six consecutive observations. The histogram’s sign change results from the recursive states catching up with that price history.

At observation 8, subtract the unrounded signal from the unrounded MACD to obtain approximately 0.0348258. Subtracting the separately rounded four-decimal labels gives 0.0349. That small display discrepancy is expected. The stored calculation should use full precision, with a note about rounding.
The general reading rule is algebraic: MACD’s sign compares fast and slow price averages; the histogram’s sign compares MACD and signal. A chart’s colours may additionally encode whether a histogram bar is rising or falling, so inspect the legend rather than assigning meaning to colour alone.
Check price scale before comparing instruments
Imagine multiplying every price in the example by ten, including the warm-up. Both price EMAs, MACD, signal and histogram also multiply by ten under the same linear calculation. A histogram of 0.348258 in that scaled dataset describes the same relative pattern as 0.0348258 in the original.
This means raw MACD magnitudes are not directly comparable across assets with very different price levels or quote units. A stock priced at 2,000 and another at 20 can have similar percentage movements and very different numerical MACDs.
Currency conversion adds another choice. Converting the whole history by a single constant factor simply rescales the values. Converting each observation at a different exchange rate changes the price path itself. For an India or Pakistan research note about a foreign security, name the quote currency and whether a currency-converted series was used.
An axis formatted with a percent sign does not turn the standard formula into a percentage oscillator. If the provider normalises the result, inspect and name that separate definition before comparing it with the ordinary price-unit MACD.
Check MACD after adding a constant to every price
Another useful audit is to add the same amount to every price, including the entire warm-up, and recompute MACD. Under the stated EMA construction, each price average increases by that amount. Their difference is unchanged, so the MACD series, signal and histogram should remain unchanged as well.
Add 50 to the worked example. The starting fast and slow EMAs become 150, and the first new close becomes 156. The fast update is 0.5 × 156 + 0.5 × 150 = 153. The slow update is one-third × 156 + two-thirds × 150 = 152. MACD is still 153 − 152 = 1. The signal remains 0.5 and histogram remains 0.5, matching the original first observation.
The signal starts from the same zero because the shifted warm-up still produces zero MACD. If only the new close is shifted while both price-EMA seeds remain 100, the first MACD becomes approximately 9.3333. That result fails the intended constant-offset test because the starting history was treated differently.
Apply this check only to a uniform shift across the full calculation history. Adding an amount from one date onward introduces a step in the input path. It does not have the same cancellation property and can change subsequent MACD values.
Verify the implementation before interpreting a mismatch
Compare the raw close series before checking indicator settings. Then match fast length, slow length, signal length, all moving-average types, seed conventions, calculation timeframe, completed-bar status and any displayed offset. A daily MACD displayed on an hourly chart can still use daily inputs.
Adjustments and gaps can alter the underlying sequence. A raw stock split step passes through both EMAs; an adjusted series may remove it. A missing close filled with zero creates a fictional shock. Use the distinctions in missing market data versus zero when inspecting an export.
Keep the component values in a market research journal. If comparing MACD with sentiment, match publication timing and measurement windows using historical sentiment research principles. Three transformations of the same prices do not constitute three independent sources of evidence.
A careful conclusion describes observed relationships and leaves prediction separate. For example: “At the final completed observation, MACD was negative and its histogram was positive under the stated 3, 5, 3 EMA construction.” That sentence remains accurate without claiming what the market must do next.
Keep a short audit record with the eight input closes, the two EMA states, MACD, signal and histogram in separate columns. A disagreement in the signal column should be traced to its previous state and averaging rule, rather than repaired by changing the price series. For a different construction whose gain/loss ratio removes price units, see our RSI calculation guide. Neither measure is a survey of investor opinion.
MACD indicator: frequently asked questions
What is the MACD line measuring?
It measures the faster moving average minus the slower moving average of a specified source. A positive result means the fast average is greater at that observation. The result describes averages, rather than the current price’s percentage change.
What is the signal line?
It is a moving average of the MACD series. Its source is MACD, not the original price directly. The signal’s averaging method, length and initialisation must be specified for an exact reconstruction.
What is the MACD histogram?
It is the difference between MACD and its signal in the construction used here. A positive bar means MACD is above the signal; a negative bar means it is below. Check custom scripts for different definitions.
Can the histogram be positive when MACD is negative?
Yes. In our final observation, MACD is approximately −0.2223 and signal is −0.2572. MACD is the less-negative number, so its difference from signal is positive. The two signs compare different pairs of values.
Does a growing histogram prove that price is rising?
No. A histogram depends on recursively smoothed values. In our example it rises for several observations while the close remains 100. Inspect the actual price changes separately from the indicator’s internal adjustment.
Are 12, 26 and 9 mandatory MACD settings?
They are common settings, not a complete universal specification. Platforms can expose different lengths and moving-average methods. Document the actual configuration, especially when comparing a standard indicator with a custom script.
Why is MACD unbounded?
Subtracting two price averages creates a difference in price units without imposing fixed limits. Its possible magnitude depends on the underlying values and their path. A value above 100 is therefore not automatically a calculation error.
Can I compare MACD readings for two different stocks?
You can compare their defined patterns carefully, but raw magnitudes depend on price scale. A larger numerical MACD does not by itself imply stronger percentage momentum. Ensure currency, adjustment basis, interval and formula are comparable.
How long should the warm-up be?
There is no single universal length for every implementation and precision requirement. Seeds, averaging coefficients and prefetched history affect early values. Preserve the starting method and test how much the result changes when additional earlier data is included.
Does a MACD crossover establish a reliable trading rule?
No. It identifies a change in the ordering of two calculated series. Any claim about future outcomes needs a separately defined and appropriately evaluated study. The crossover itself supplies no guaranteed result or investment recommendation.
To explore the wider service, visit CrowdSent and its current membership options. This worked example is an editorial learning resource, not a claim that a membership includes this calculation, a particular indicator, or a trading strategy.
Primary documentation checked 24 October 2026.
Educational information only. All numerical examples are hypothetical. This article provides no investment recommendation or forecast.