Direct answer
A worked example of MACD and moving average is a fully specified calculation where you choose indicator settings, define the price series, compute each moving average step-by-step, then derive MACD, the signal line, and the histogram. It also requires stating assumptions, because the same market data can produce different indicator values if you change settings (for example, the averaging windows) or if you use different price inputs (close vs. typical price).
This article gives one transparent scenario with explicit numbers. It does not use live market data and it does not claim that the indicator predicts outcomes.
Mechanism or definition
A moving average is a smoothing method that produces a line value based on recent prices. Two common types are:
- Simple Moving Average (SMA): the average of the last N prices.
- Exponential Moving Average (EMA): a weighted average where recent prices receive more weight.
MACD (Moving Average Convergence Divergence) is constructed from moving averages. A common MACD structure uses:
- A faster moving average (often an EMA with a shorter window)
- A slower moving average (often an EMA with a longer window)
- MACD line = (fast MA) − (slow MA)
- Signal line = a smoothing of the MACD line (often an EMA of MACD)
- Histogram = MACD line − signal line
Important distinction: a moving average is the smoother of prices, while the MACD line is the smoother of the difference between two moving averages.
Evidence or example (numerical scenario)
Assumptions for this worked example (all stated so you can recompute):
- Price series is the closing price for consecutive days.
- We use SMA for both moving averages to keep arithmetic verifiable.
- Fast window = 3 days, slow window = 5 days.
- Signal smoothing for MACD uses an SMA over 2 MACD values.
- We start calculations only when enough data points exist.
Let the closing prices for 1–7 be:
- Day 1: 100
- Day 2: 101
- Day 3: 102
- Day 4: 101
- Day 5: 103
- Day 6: 104
- Day 7: 103
Step 1: Compute fast and slow moving averages
For Day 5:
- Fast SMA(3) = average of Days 3–5 = (102 + 101 + 103) / 3 = 306 / 3 = 102
- Slow SMA(5) = average of Days 1–5 = (100 + 101 + 102 + 101 + 103) / 5 = 507 / 5 = 101.4
- MACD(5) = fast − slow = 102 − 101.4 = 0.6
For Day 6:
- Fast SMA(3) = Days 4–6 = (101 + 103 + 104) / 3 = 308 / 3 = 102.6667
- Slow SMA(5) = Days 2–6 = (101 + 102 + 101 + 103 + 104) / 5 = 511 / 5 = 102.2
- MACD(6) = 102.6667 − 102.2 = 0.4667
For Day 7:
- Fast SMA(3) = Days 5–7 = (103 + 104 + 103) / 3 = 310 / 3 = 103.3333
- Slow SMA(5) = Days 3–7 = (102 + 101 + 103 + 104 + 103) / 5 = 513 / 5 = 102.6
- MACD(7) = 103.3333 − 102.6 = 0.7333
Step 2: Compute signal line and histogram
Signal line is an SMA over the last 2 MACD values.
For Day 6:
- Signal(6) = average of MACD(5) and MACD(6) = (0.6 + 0.4667) / 2 = 0.53335
- Histogram(6) = MACD(6) − Signal(6) = 0.4667 − 0.53335 = −0.06665
For Day 7:
- Signal(7) = average of MACD(6) and MACD(7) = (0.4667 + 0.7333) / 2 = 0.6
- Histogram(7) = MACD(7) − Signal(7) = 0.7333 − 0.6 = 0.1333
How to interpret the mechanics (not as a standalone trading signal):
- When MACD is above its signal line, histogram is positive.
- When MACD is below its signal line, histogram is negative.
- A positive histogram in this example results from MACD increasing relative to its own recent average.
Connection to “moving average”
This scenario includes moving averages at two levels:
- Moving averages smooth prices (fast and slow MAs).
- MACD then applies an additional smoothing (signal line) to the difference between those price-based smoothers.
Limitations and risks
- Settings matter: changing fast/slow windows or the signal smoothing method changes the numeric MACD and histogram values even on the same price series. - Lag can occur: moving averages are smoothing methods; they often respond after price changes begin. - Failure mode in certain regimes: in sideways or choppy conditions, the difference between fast and slow averages can oscillate, causing histogram sign changes that may not correspond to sustained movements.