Trading education · Trading indicators
MACD Indicator: Lines, Histogram and Worked Example
Learn the MACD line, signal line and histogram, including 12/26/9 settings, zero-line crosses, divergence and a transparent numerical example.
The short answer
MACD compares a fast and a slow exponential moving average. Its signal line smooths that difference, and its histogram measures the gap between the two. A positive histogram can coexist with a negative MACD line because they describe different relationships.
Separate the three components.
MACD stands for Moving Average Convergence/Divergence. In the common 12/26/9 configuration, subtract the 26-period EMA from the 12-period EMA, then calculate a nine-period EMA of that difference. Fidelity: MACD components and default settings documents these conventional settings.
MACD line = EMA(12) − EMA(26)
Signal line = EMA(9) of the MACD line
Histogram = MACD line − signal line
The numbers count periods on the chosen chart. “12” on a daily chart and “12” on a fifteen-minute chart represent very different horizons. Platform conventions differ: MetaTrader 5 documents an SMA signal line, whereas the formula above uses an EMA. MetaTrader also draws the MACD value itself as bars. Check the component labels and calculation; bars are not automatically the MACD-minus-signal histogram taught here.
Unlike RSI, MACD is not bounded between 0 and 100. Its raw values inherit price units, which makes direct comparisons across differently priced instruments misleading.
A EUR/USD example in price units.
Suppose the current fast EMA is 1.1050 and the slow EMA is 1.1030. MACD is 0.0020, equivalent to 20 conventional EUR/USD pips as a price difference. If the signal line is 0.0015, the histogram is 0.0005, or 5 pips. These are indicator distances, not a trade's cash profit.
Now consider another snapshot: MACD is −0.0020 and its signal line is −0.0030. The histogram is +0.0010 even though the MACD line remains below zero. The fast EMA is still below the slow EMA, but their difference is above its own smoothed history.
A shrinking positive histogram means MACD is moving closer to its signal line. It does not necessarily mean price is falling. Price can continue rising while the relationship between its averages changes at a slower rate.
Try it: MACD is +0.0010 and its signal line is +0.0015. Find the histogram and state which price EMA is higher.
Check your answer
The histogram is −0.0005 because 0.0010 − 0.0015 = −0.0005. The fast price EMA is still above the slow EMA because MACD itself is positive. A negative histogram does not mean the fast price EMA is below the slow EMA.
Different crosses describe different events.
| Event | Direct interpretation | Possible failure |
|---|---|---|
| MACD crosses zero | Fast and slow price EMAs exchange their ordering. | A sideways move can repeatedly reverse the ordering. |
| MACD crosses its signal | The difference between price EMAs crosses its own smoother. | A brief change can reverse without a sustained price move. |
| Histogram crosses zero | The same line/signal crossover expressed as bars. | It is not an additional independent confirmation. |
| Price / MACD divergence | Selected price swings and indicator swings disagree. | The trend can persist through several divergences. |
A histogram colour change may mark growth versus shrinkage rather than a zero crossing. Read the platform legend. Two charts can show the same numerical values with different colour conventions, creating an apparent disagreement where none exists.
A crossover can be correct and still lose.
Imagine a completed hourly bullish signal-line crossover. The next tradable price is already above the signal candle's close, after a fast move. A later retracement hits the planned stop before any target is reached. The indicator calculation was correct; the entry/exit hypothesis lost money.
Another failure occurs when a range generates alternating crossovers. A study that ignores spread and enters at the ideal signal price may look much better than a model that buys at ask, sells at bid and includes commission. See position sizing with costs for how execution assumptions enter the arithmetic.
Do not repair a losing sample by changing the fast, slow and signal lengths on the same data until the chart looks good. That process selects for historical fit. Keep a later period untouched and retain the original settings and comparison criteria.
A practical MACD review workflow.
- Confirm the instrument, price feed, timeframe and smoothing settings.
- State whether the observation uses completed candles only.
- Choose one event: zero cross, signal cross or a defined divergence.
- Specify entry timing, stop, target, expiry and any no-trade conditions.
- Review losses, missed fills and costs as well as favourable examples.
Use a chart observation to formulate a testable question. For example: does a particular signal-line cross add useful information after a separately defined trend filter? That can be evaluated. “The MACD looks strong” cannot be reproduced reliably.
Neither a histogram bar nor a crossover determines how much capital is exposed. Check the position-size calculator separately and confirm the instrument's margin requirements.
Work through it yourself.
Follow RSI, moving-average and MACD calculations using an editable practice price series.
Download indicator calculation workbook Excel workbook · editable formulasFree to download without registering. Practice examples explain the method; they do not establish a profitable strategy.
Common MACD questions.
Are 12/26/9 the best settings?
They are a common default, not an optimality claim. A valid comparison needs fixed inputs, stated execution rules and an independent evaluation period.
Can the histogram be positive while MACD is negative?
Yes. If MACD is −0.002 and the signal is −0.003, their difference is +0.001. The histogram compares the lines, while the zero line compares the fast and slow price averages.
Does MACD show overbought and oversold levels?
It has no fixed upper or lower bounds. Treating a raw MACD value as a universal overbought threshold across instruments or timeframes is misleading.
Sources & assumptions.
Written by InsomniCapital. Content checked on 4 October 2026. Schematics and hypothetical calculations are labelled educational illustrations. Historical observations identify their source, dates and method separately. Neither is a live quote, trade recommendation or reported trading result.
- Fidelity: MACD components and default settings.
- Fidelity: exponential moving averages.
- Fidelity: RSI definition and calculation.
- MetaTrader 5: MACD signal-line calculation.
- MQL5: MACD display and indicator buffers.
Educational information only, not personalised investment advice. Leveraged trading carries a high risk of loss. Read our risk disclosure. InsomniCapital has an Axi affiliate relationship and may receive compensation for qualifying referrals. References are not endorsements of this guide.
In this lesson
- Calculate the difference between MACD and its signal line.
- Distinguish a zero-line cross from a signal-line cross.
Course outline
The complete course
8 modules. One clear path.
Follow the lessons in order, or return to a topic when you need it. Every lesson is open.
01Forex trading fundamentals10 lessons · Not started
Check brokers, rehearse a demo workflow, then study quotes, orders, costs, exposure and the demands of a trading day.
- Forex trading for beginnersNot studied
- How to Check a Forex Broker’s RegulationNot studied
- How to Use a Forex Demo AccountNot studied
- Forex order typesNot studied
- How to Place, Manage and Close a Forex TradeNot studied
- Spreads, slippage and swapsNot studied
- Margin and leverageNot studied
- Margin calls and stop-outsNot studied
- Day trading, swing trading and scalpingNot studied
- Forex market hoursNot studied
02Position sizing and risk management7 lessons · Not started
Connect price distances, contract assumptions and combined currency exposure to cash risk, payoff and drawdown.
- Stop-loss distances in pipsNot studied
- EUR/USD position sizingNot studied
- JPY pip valuesNot studied
- Position sizing with trading costsNot studied
- Forex Correlation and Combined Currency ExposureNot studied
- Risk-reward ratiosNot studied
- Drawdown and recoveryNot studied
03Price action and chart patterns5 lessons · Not started
Work from completed observations to candles, zones, multiple timeframes and clearly stated pattern boundaries.
- Price action tradingNot studied
- Candlestick patternsNot studied
- Support and resistanceNot studied
- Multiple Timeframe Analysis in ForexNot studied
- Chart patternsNot studied
04Trading indicators3 lessons · Not started
Study what moving averages, RSI and MACD calculate before interpreting a signal.
- Moving averages: EMA and SMANot studied
- RSI indicatorNot studied
- MACD indicatorNot studied
05Gold trading and XAU/USD4 lessons · Not started
Identify the product, translate lots into ounces and work through results and position sizing.
- Gold trading for beginnersNot studied
- Gold contract sizes and lot sizesNot studied
- Gold profit and lossNot studied
- Gold position sizingNot studied
06Economic indicators and central banks9 lessons · Not started
Read currency drivers, inflation, growth and policy announcements with their expectations and revisions.
- Central banks and currency pricesNot studied
- Nonfarm payrolls (NFP)Not studied
- CPI inflationNot studied
- PCE inflationNot studied
- GDP growth and revisionsNot studied
- PMI explainedNot studied
- Retail sales explainedNot studied
- Central bank decisionsNot studied
- FOMC meetingsNot studied
07Forex strategies and backtesting5 lessons · Not started
Define a reproducible study, audit its assumptions and work through breakout, trend and range examples.
- Forex trading strategiesNot studied
- Backtesting trading strategiesNot studied
- Breakout trading strategiesNot studied
- Trend-following strategiesNot studied
- Range trading strategiesNot studied
08Trading psychology and signals2 lessons · Not started
Review the process behind a result and the records needed to assess a performance claim.
- Trading psychologyNot studied
- Forex signals explainedNot studied
Lesson 25 checkpoint
Put the reading into practice
Work it through
Calculate the histogram when MACD is −0.0020 and its signal is −0.0030. Explain how a positive histogram can coexist with a negative MACD line.
The checkbox records study; answering every checkpoint question correctly records a separate pass. Try the module assessment for a mixed question set. Read the evidence standards for how examples and claims are presented.