Moving Average Convergence Divergence
systemic:core-macdIndicatorsInputs
| Name | Type | Description |
|---|---|---|
| Short Window / Short EMA | Whole number | The number of bars for the **fast EMA** in the MACD calculation. |
| Long Window / Long EMA | Whole number | The number of bars for the **slow EMA** in the MACD calculation. |
| Signal Window / Signal Line | Whole number | The window of the **Signal Line EMA**, which this module does not output and which does not change the MACD Line. |
| Price | Number series | The price series used for the MACD calculation. |
Outputs
| Name | Type | Description |
|---|---|---|
| MACD | Number series | The **MACD Line**: the fast exponential moving average minus the slow one. |
Cost
0.205 + 0.00574·n credits for n bars, rounded up. The marks are each plan's limit of bars.
The MACD (Moving Average Convergence Divergence) is one of the best-known momentum indicators in technical analysis. Gerald Appel created it in the late 1970s. It is still widely used because it combines trend-following and momentum analysis in a single measure.
What this module outputs: The MACD Line: the difference between a fast and a slow EMA. To build a complete MACD with Signal Line and Histogram, combine this module with an EMA module and a Subtract module.
The Intuition Behind MACD
When a fast moving average is above a slow moving average, recent prices are higher than the longer-term average: bullish momentum. When it is below, recent prices are lower: bearish momentum.
MACD measures the distance between the two averages.
flowchart LR
subgraph Price["Price Action"]
P["Closing Prices"]
end
subgraph EMAs["Exponential Moving Averages"]
F["Fast EMA (12)"]
S["Slow EMA (26)"]
end
subgraph Output["MACD Line"]
M["Fast − Slow"]
end
P --> F
P --> S
F --> M
S --> M
Interpreting MACD Values
| MACD Value | Meaning |
|---|---|
| Positive (+) | Fast EMA > Slow EMA → Bullish momentum |
| Negative (−) | Fast EMA < Slow EMA → Bearish momentum |
| Rising | Momentum is strengthening |
| Falling | Momentum is weakening |
| Crossing Zero | Trend direction may be reversing |
The Zero Line
The zero line is where the fast and slow EMAs are equal. A cross above or below zero often signals a trend change:
flowchart TD
subgraph Above["MACD > 0"]
A1["Fast EMA above Slow EMA"]
A2["Uptrend momentum"]
end
subgraph Cross["MACD = 0"]
C1["EMAs are equal"]
C2["Potential trend change"]
end
subgraph Below["MACD < 0"]
B1["Fast EMA below Slow EMA"]
B2["Downtrend momentum"]
end
Above --> Cross --> Below
Configuration Parameters
| Parameter | Standard value | Description |
|---|---|---|
| Short Window | 12 | Fast EMA window |
| Long Window | 26 | Slow EMA window |
| Signal Window | 9 | Window of the Signal Line. It does not change the MACD Line |
Why 12-26-9?
The module has no built-in defaults. These standard values were set by Gerald Appel for daily stock charts:
- 12 days ≈ Two trading weeks (short-term trend)
- 26 days ≈ One trading month (medium-term trend)
- 9 days ≈ Signal Line smoothing
Alternative Configurations
| Market Condition | Short | Long | Rationale |
|---|---|---|---|
| High Volatility | 8 | 17 | More responsive to rapid changes |
| Low Volatility | 19 | 39 | Filters out noise |
| Crypto (24/7) | 12 | 26 | Standard works well |
| Weekly Charts | 12 | 26 | Same proportions, larger timeframe |
Building a Complete MACD System
This module outputs only the MACD Line. To build a full MACD, combine it with other modules:
flowchart TD
subgraph Step1["1. MACD Module"]
M["MACD Line = EMA₁₂ − EMA₂₆"]
end
subgraph Step2["2. Add EMA Module"]
E["Signal Line = EMA₉ of MACD"]
end
subgraph Step3["3. Add SUB Module"]
H["Histogram = MACD − Signal"]
end
subgraph Signals["Trading Signals"]
S1["Crossovers"]
S2["Zero-line crosses"]
S3["Divergence"]
end
Step1 --> Step2 --> Step3 --> Signals
Complete MACD Components
| Component | Formula | What It Shows |
|---|---|---|
| MACD Line | EMA₁₂ − EMA₂₆ | Momentum direction |
| Signal Line | EMA₉ of MACD | Smoothed momentum |
| Histogram | MACD − Signal | Momentum acceleration |
Trading Strategies
Strategy 1: Zero-Line Crossover
The simplest MACD signal: MACD crosses zero.
| Signal | Condition | Interpretation |
|---|---|---|
| Bullish | MACD crosses above 0 | Short-term trend now above long-term |
| Bearish | MACD crosses below 0 | Short-term trend now below long-term |
Strength: These signals are less frequent but more reliable than Signal Line crossovers.
Strategy 2: MACD Direction
Watch whether MACD is rising or falling, whatever its level.
| MACD Behavior | Interpretation |
|---|---|
| Rising from deeply negative | Bearish momentum slowing, potential reversal |
| Falling from positive | Bullish momentum weakening |
| Accelerating upward | Strong bullish pressure |
Strategy 3: Divergence Detection
Compare the direction of MACD with the direction of price. A divergence often comes before a reversal.
| Type | Price Action | MACD Action | Meaning |
|---|---|---|---|
| Bullish Divergence | Lower lows | Higher lows | Selling exhaustion |
| Bearish Divergence | Higher highs | Lower highs | Buying exhaustion |
MACD vs. Other Indicators
| Indicator | Measures | MACD Advantage |
|---|---|---|
| RSI | Overbought/Oversold | MACD shows trend direction |
| Stochastic | Price position in range | MACD works in trends, not just ranges |
| ADX | Trend strength only | MACD shows direction + momentum |
| Simple MA Crossover | Trend only | MACD is smoother (uses EMAs) |
Strengths
| Aspect | Benefit |
|---|---|
| Dual nature | Captures both trend and momentum |
| Visual clarity | Easy to interpret rising/falling patterns |
| Versatility | Works across timeframes and asset classes |
| Well-established | Decades of trader experience and research |
Limitations
| Aspect | Challenge |
|---|---|
| Lagging | Based on moving averages—inherently delayed |
| False signals | Whipsaws common in ranging/choppy markets |
| Not bounded | Unlike RSI, no overbought/oversold levels |
| Requires confirmation | Best used with other indicators |
Combining MACD with Other Modules
| Combination | Purpose |
|---|---|
| MACD + EMA | Create Signal Line for crossover signals |
| MACD + RSI | Confirm: MACD bullish + RSI not overbought = stronger signal |
| MACD + ATR | Use ATR for position sizing based on volatility |
| MACD + Volume | Volume spike + MACD cross = higher confidence |
| MACD + Bollinger Bands | Volatility squeeze + MACD cross = breakout signal |
Historical Context
Gerald Appel introduced MACD in his 1979 book "The Moving Average Convergence Divergence Trading Method". It was designed for stocks, but it is now used across asset classes: forex, crypto, commodities and indices.
The indicator has been in use for over 45 years. It captures a basic market pattern: short-term momentum compared with the longer-term trend.
Data Alignment in Systemic
The MACD module takes one price series, price_data. The three window parameters (Short, Long, Signal) are constants.
Single-Input Behavior
The price_data input usually comes directly from an asset data source. It can also be the output of another module:
- The output has one value per bar of the input
- No alignment is needed, because only one series is used
Parameter Constants
All three window parameters (Short, Long, Signal) are constants:
- Each is one fixed value for the whole run
- This keeps the EMA calculation the same across the whole series
Data Length Requirements
The run fails if the price series has fewer bars than:
With the standard settings (12, 26, 9), you need at least 26 bars.
Missing Data
Both EMAs use only the bars that have data:
- Closed-market gaps (e.g. weekends) stay empty and are skipped. A missing input bar gives an empty output on that bar. It never repeats the previous MACD value and is never 0. The EMAs treat the next bar with data (e.g. Monday) as the bar right after the last bar with data (Friday), not as several calendar days later.
- Warm-up is empty, never
0.0. The firstlong_window − 1bars with data have no MACD value, so the warm-up cannot be misread as a zero-line crossover.
Indicator Profile
This chart compares how useful MACD is for stocks and for cryptocurrencies:
quadrantChart
title MACD Indicator Profile
x-axis Low Popularity --> High Popularity
y-axis Low Reliability --> High Reliability
quadrant-1 High potential
quadrant-2 Established leaders
quadrant-3 Niche tools
quadrant-4 Popular but risky
MACD - Stocks: [0.90, 0.75]
MACD - Crypto: [0.85, 0.65]
Dimension Ratings
| Dimension | Stocks | Crypto | Notes |
|---|---|---|---|
| Popularity | 9.0/10 | 8.5/10 | One of the most widely used indicators globally. Standard on every trading platform. |
| Reliability | 7.5/10 | 6.5/10 | Reliable in trending markets. Crypto's higher volatility increases false signals. |
| Complexity | 4.0/10 | 4.0/10 | Conceptually simple (EMA difference). Most traders can interpret it quickly. |
| Versatility | 8.5/10 | 8.0/10 | Works across all timeframes and asset classes. The standard settings are widely applicable. |
| Recent Interest | 7.5/10 | 7.0/10 | Steady classic indicator. Continues to appear in research and trading education. |