MACD Momentum Shift + Divergence [Gabremoku]

MACD Momentum Shift + Divergence [Gabremoku] is an enhanced MACD oscillator built to highlight momentum transitions, zero-line regime shifts, signal-line crosses, and automatic bullish/bearish divergences in one clean visual framework.
The script starts from the classic MACD structure, then expands it with:
MACD is widely used to track both trend direction and momentum by comparing a fast EMA with a slower EMA, while the signal line and histogram help reveal changes in momentum strength and timing.
What it shows
๐ MACD line โ the main oscillator line, colored dynamically to reflect bullish, bearish, or neutral momentum pressure.
๐ Histogram โ shows the difference between MACD and signal line, helping visualize whether momentum is accelerating or fading. Positive histogram values generally indicate bullish momentum relative to the signal line, while negative values indicate bearish momentum.
๐ Dynamic gradient fill โ the area above and below zero changes intensity depending on how far MACD is from the zero line.
๐ Signal line โ the smoothed reference line used for MACD crossover logic.
๐ Automatic divergences โ the script detects:
Bullish divergence: price makes a lower low while MACD makes a higher low
Bearish divergence: price makes a higher high while MACD makes a lower high
๐ท๏ธ Entry/Exit labels โ optional BUY / SELL / SHORT / CLOSE labels based on the selected strategy mode.
๐ชง Dashboard โ displays shift, state, MACD value, pressure, zone, and sequence status.
Core logic
This indicator is built around the idea that MACD is not just a crossover tool, but a momentum structure tool.
Instead of reading MACD only as a fast/slow EMA crossover, this script emphasizes:
where MACD is relative to zero
how histogram behaves
whether momentum is expanding or pulling back
whether price and MACD are diverging
A MACD reading above zero generally suggests the shorter EMA is above the longer EMA, while a reading below zero suggests the opposite. Zero-line crosses are commonly interpreted as broader trend or momentum regime shifts.
Signal logic
The indicator supports both Long and Short strategy modes.
Long mode
Short mode
This combines two classic MACD interpretations:
Divergence logic
This helps spot moments where price continues making new highs or lows but MACD loses confirmation, which is commonly interpreted as a warning that momentum is weakening. Even so, divergence is generally more reliable when paired with confirmation such as structure breaks, reversal candles, or support/resistance context.
State model
The script classifies momentum into states such as:
This gives more nuance than a standard MACD display because it separates:
directional bias from zero-line position
and internal acceleration/deceleration from histogram behavior
Features
โ Classic MACD with customizable fast, slow, and signal lengths
โ Dynamic gradient fill around the zero line
โ Momentum-aware histogram coloring
โ Zero-line and signal-line sequence logic
โ Long / Short strategy mode
โ Automatic bullish and bearish divergence detection
โ Optional divergence labels and lines
โ On-chart BUY / SELL / SHORT / CLOSE labels
โ Live dashboard
โ Last-value MACD label
โ Alert-ready structure through visual signal logic
How to use
A practical reading method is:
Use the zero line to define broader bullish or bearish regime.
Use the signal-line crossover for timing.
Read the histogram to see whether momentum is expanding or weakening.
Use divergences as a warning or confirmation layer, not as a standalone trigger.
In practice:
MACD above zero = bullish bias
MACD below zero = bearish bias
MACD crossing signal line = momentum timing event
bullish divergence can warn of downside exhaustion
bearish divergence can warn of upside exhaustion
Notes
This indicator is designed to help read momentum state, transitions, and divergence structure more clearly than a standard MACD. Like all divergence-based tools, it works best with confirmation and tends to be less reliable in choppy range conditions where MACD can whipsaw around the signal line and zero line.
Author: Gabremoku
Pine Script v6
The script starts from the classic MACD structure, then expands it with:
- a dynamic gradient fill around the zero line
- a momentum-aware histogram
- sequence-based long/short signal logic
- and automatic divergence detection with labels and lines
MACD is widely used to track both trend direction and momentum by comparing a fast EMA with a slower EMA, while the signal line and histogram help reveal changes in momentum strength and timing.
What it shows
๐ MACD line โ the main oscillator line, colored dynamically to reflect bullish, bearish, or neutral momentum pressure.
๐ Histogram โ shows the difference between MACD and signal line, helping visualize whether momentum is accelerating or fading. Positive histogram values generally indicate bullish momentum relative to the signal line, while negative values indicate bearish momentum.
๐ Dynamic gradient fill โ the area above and below zero changes intensity depending on how far MACD is from the zero line.
๐ Signal line โ the smoothed reference line used for MACD crossover logic.
๐ Automatic divergences โ the script detects:
Bullish divergence: price makes a lower low while MACD makes a higher low
Bearish divergence: price makes a higher high while MACD makes a lower high
๐ท๏ธ Entry/Exit labels โ optional BUY / SELL / SHORT / CLOSE labels based on the selected strategy mode.
๐ชง Dashboard โ displays shift, state, MACD value, pressure, zone, and sequence status.
Core logic
This indicator is built around the idea that MACD is not just a crossover tool, but a momentum structure tool.
Instead of reading MACD only as a fast/slow EMA crossover, this script emphasizes:
where MACD is relative to zero
how histogram behaves
whether momentum is expanding or pulling back
whether price and MACD are diverging
A MACD reading above zero generally suggests the shorter EMA is above the longer EMA, while a reading below zero suggests the opposite. Zero-line crosses are commonly interpreted as broader trend or momentum regime shifts.
Signal logic
The indicator supports both Long and Short strategy modes.
Long mode
- BUY can trigger from:
- MACD crossing above zero
- MACD crossing above the signal line
- SELL can trigger from:
- MACD crossing below zero
- MACD crossing below the signal line
Short mode
- SHORT can trigger from:
- MACD crossing below zero
- MACD crossing below the signal line
- CLOSE can trigger from:
- MACD crossing above zero
- MACD crossing above the signal line
This combines two classic MACD interpretations:
- zero line for broader trend bias
- signal line for faster momentum timing
Divergence logic
- One of the strongest parts of this script is the divergence engine.
- It identifies pivot-based MACD divergences and can draw both:
- visual labels on the oscillator
- connecting divergence lines
This helps spot moments where price continues making new highs or lows but MACD loses confirmation, which is commonly interpreted as a warning that momentum is weakening. Even so, divergence is generally more reliable when paired with confirmation such as structure breaks, reversal candles, or support/resistance context.
State model
The script classifies momentum into states such as:
- Bullish Expansion
- Bullish Pullback
- Bearish Expansion
- Bearish Pullback
- Neutral
This gives more nuance than a standard MACD display because it separates:
directional bias from zero-line position
and internal acceleration/deceleration from histogram behavior
Features
โ Classic MACD with customizable fast, slow, and signal lengths
โ Dynamic gradient fill around the zero line
โ Momentum-aware histogram coloring
โ Zero-line and signal-line sequence logic
โ Long / Short strategy mode
โ Automatic bullish and bearish divergence detection
โ Optional divergence labels and lines
โ On-chart BUY / SELL / SHORT / CLOSE labels
โ Live dashboard
โ Last-value MACD label
โ Alert-ready structure through visual signal logic
How to use
A practical reading method is:
Use the zero line to define broader bullish or bearish regime.
Use the signal-line crossover for timing.
Read the histogram to see whether momentum is expanding or weakening.
Use divergences as a warning or confirmation layer, not as a standalone trigger.
In practice:
MACD above zero = bullish bias
MACD below zero = bearish bias
MACD crossing signal line = momentum timing event
bullish divergence can warn of downside exhaustion
bearish divergence can warn of upside exhaustion
Notes
This indicator is designed to help read momentum state, transitions, and divergence structure more clearly than a standard MACD. Like all divergence-based tools, it works best with confirmation and tends to be less reliable in choppy range conditions where MACD can whipsaw around the signal line and zero line.
Author: Gabremoku
Pine Script v6
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.