Signal line cross up
The textbook MACD long trigger, filtered for quality by the zero-line regime.
Moving Average Convergence Divergence
A trend-momentum indicator built from the difference between two EMAs, plus a signal line and histogram that visualise momentum shifts.
MACD is a trend-momentum indicator built from the difference between a 12-bar and 26-bar EMA, plus a 9-bar signal line and a histogram. The signal-line cross marks momentum shifts; the zero line marks the trend regime. Default settings: 12, 26, 9.
MACD is the difference between a fast EMA (default 12) and a slow EMA (default 26). A third EMA of that difference (default 9) becomes the signal line, and the gap between MACD and signal is plotted as a histogram.
The three classic reading lenses are: the MACD/signal cross (momentum shift), the zero-line position (regime: above zero bullish, below zero bearish), and the histogram slope (acceleration or deceleration of momentum). MACD behaves poorly in choppy markets because the EMAs whip around — pair it with a regime filter for usable results.
Entry ideas
The textbook MACD long trigger, filtered for quality by the zero-line regime.
A slower regime-change long that catches larger, cleaner trends with fewer false starts.
An aggressive early-entry long that buys the first sign of momentum reclamation.
Exit ideas
A symmetrical momentum-flip exit that mirrors the classic MACD entry trigger.
A patient exit that lets winners run until the whole trend regime flips.
An early exit that locks gains when momentum starts fading at the top.
Utilities
A cheap bias filter that keeps any directional system on the right side of the prevailing trend.
A higher-timeframe trend filter that keeps entries aligned with the daily MACD regime.
| Parameter | Default | When to adjust |
|---|---|---|
| Fast EMA length | 12 | Gerald Appel's original setting. Drop to 8 for faster signals on crypto/intraday; raise to 19 for less noise on weekly charts. |
| Slow EMA length | 26 | Original setting. Keep paired with fast EMA at roughly 2× the fast length. |
| Signal length | 9 | EMA smoothing of the MACD line. Tighter (5) gives earlier signals with more whipsaws; wider (14) is smoother but later. |
| Source | Close | Most common. HLC3 produces smoother readings on volatile assets. |
//@version=5
indicator("MACD Example", overlay=false)
fastLen = input.int(12, title="Fast Length", minval=1)
slowLen = input.int(26, title="Slow Length", minval=1)
signalLen = input.int(9, title="Signal Length", minval=1)
src = input.source(close, title="Source")
[macdLine, signalLine, hist] = ta.macd(src, fastLen, slowLen, signalLen)
plot(macdLine, title="MACD", color=color.blue)
plot(signalLine, title="Signal", color=color.orange)
plot(hist, title="Histogram", color=hist >= 0 ? color.green : color.red, style=plot.style_columns)
hline(0, "Zero", color=color.gray)Pine's ta.macd() returns three values in one call: the MACD line, signal line, and histogram. Plotting the histogram as columns (green when positive, red when negative) makes momentum acceleration visually obvious. Wire all three lengths to inputs so users can tune without touching code. The hline at zero anchors the regime read at a glance.
MACD measures the relationship between two exponential moving averages of different lengths, then smooths that relationship into a signal line and visualises the gap as a histogram.
MACD is a trend-momentum indicator — its strength is catching directional moves and signalling fading momentum. It fails reliably in three regimes.
Choppy ranges are the most common failure: when price oscillates within a band, the MACD line whips across the signal line, generating false trigger after false trigger. Each cross looks valid in isolation; in aggregate they bleed accounts.
Low-volatility, gentle drifts produce histogram readings near zero with no acceleration — there is no edge to trade because there is no sustained momentum to confirm.
Trend-rotation periods (when one trend dies and another struggles to start) produce ambiguous signals, with the MACD line dancing around zero.
Pair MACD with a regime filter (ADX above 20, range-detection logic, or Bollinger Band squeeze) to gate when its signals are trade-worthy.
| Indicator | When to prefer |
|---|---|
| EMA crossover | A simple two-EMA crossover gives the same regime info without the signal-line layer; cleaner for pure trend-following systems. |
| RSI | RSI is bounded 0–100 and better at flagging overbought/oversold extremes; MACD is unbounded and better at trend strength. |
| Supertrend | Supertrend gives a single binary regime read with built-in volatility-adjusted stops; MACD gives more nuance but requires interpretation. |
The MACD line is the difference between two EMAs (default 12 and 26 bars), reflecting the gap between fast and slow trend speeds. The signal line is a 9-bar EMA of the MACD line — a smoothed version that lags slightly. Crosses between the two are the timing signal; the MACD line itself shows the underlying trend regime.
Gerald Appel's original 12/26/9 settings, designed in the 1970s for daily stock charts, remain the de facto standard across stocks, forex, and crypto. They balance responsiveness against noise. Tune only when you have out-of-sample data showing a different setting holds up — most custom tunings overfit single backtest windows.
MACD measures the gap between two EMAs. In a range, both EMAs converge toward the mean and the MACD line oscillates around zero, producing constant signal-line crosses with no follow-through. Pair with a regime filter (ADX above 20, Bollinger squeeze) so you only trade its crosses when the market is actually trending.
Use MACD for trend-following: it tells you which side of the market to be on (zero-line position) and times momentum shifts (signal-line cross). Use RSI for mean-reversion: it flags stretched extremes and momentum divergences. Many systems combine both — MACD for direction, RSI for entry timing within that direction.
Continue exploring
Exponential Moving Average
A weighted moving average that gives more influence to recent prices, making it more responsive to new information than a simple moving average.
View EMAMomentumRelative Strength Index
A momentum oscillator that measures the speed and magnitude of recent price changes on a bounded 0–100 scale.
View RSIVolatilityBollinger Bands
A volatility envelope built from a moving average and ±2 standard deviations, expanding and contracting as volatility changes.
View BBAbout these ideas
Each entry, exit, and utility rule in the Playbook is hand-picked from established trading literature, validated against historical backtests, and reviewed by the PineWiz team. We add new ideas as we encounter them and refresh existing ones when market behavior or default settings shift. Last review: .
Educational content. Not financial advice.