MACD 4C with Divergence
Apr 28, 2024

The MACD 4C with Divergence indicator provides an enhanced visualization of market momentum by utilizing a four-color histogram and automated divergence detection. This tool aims to help traders identify potential trend reversals and momentum shifts more effectively than the traditional MACD.
Usage
The indicator can be utilized for both trend confirmation and reversal spotting. Traders can monitor the histogram's four-color output to gauge the strength of the current move:
- Dark Green/Lime: Increasing bullish momentum.
- Light Green: Decreasing bullish momentum.
- Dark Red/Maroon: Increasing bearish momentum.
- Light Red: Decreasing bearish momentum.
The script also automatically plots bullish and bearish divergences. A purple circle indicates a bullish divergence (lower price lows vs. higher histogram lows), while a red circle indicates a bearish divergence (higher price highs vs. lower histogram highs). These signals are often used to anticipate potential exhaustion in the prevailing trend.
Details
This script is based on the traditional MACD calculation but incorporates logic to detect pivot points in the histogram. By comparing these pivot points against price action, it identifies discrepancies that form divergences. The "4C" aspect refers to the color-coded histogram logic that compares the current histogram value to its previous value to determine if momentum is accelerating or decelerating. This version includes credits to original concepts by vkno422 and has been optimized for visual clarity and alert functionality.
Settings
- Fast moving average: Sets the period for the shorter-term EMA used in the MACD calculation.
- Slow moving average: Sets the period for the longer-term EMA used in the MACD calculation.
- Signal smoothing: Determines the smoothing period for the signal line.
- Look Back Right: The number of bars to the right of a pivot point to confirm its validity.
- Look Back Left: The number of bars to the left of a pivot point to confirm its validity.
FAQ
How do I access the MACD 4C with Divergence?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
What do the different histogram colors mean?
The colors represent the direction and strength of momentum. Bright colors signify that momentum is increasing in the current direction, while faded colors suggest that momentum is beginning to wane.
Are the divergence signals lagging?
Because the script uses pivot points to identify divergences, signals appear with a small delay (defined by the "Look Back Right" setting) to ensure the peak or trough is confirmed.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.