OPEN-SOURCE SCRIPT
ADX Divergence and Gap Monitor [theUltimator5]

ADX Divergence and Gap Monitor is a custom technical analysis tool designed to visualize momentum imbalances and sudden shifts in trend participation using the ADX system. It combines traditional ADX, DI+ and DI− calculations with dynamic filtering and visual highlighting to help identify key moments of directional acceleration or weakening.
🔍 What It Does:
This indicator builds on the Average Directional Index (ADX) system to detect conditions where market trend strength diverges significantly from directional input (DI) activity. It includes two major visual signals:
Highlight Backgrounds
These appear when the indicator detects a “gap” or sudden acceleration in DI values while ADX remains low, suggesting early-stage momentum bursts or signal noise spikes.
The trigger threshold for DI change can be adjusted using the Gap Trigger Level input.
A background highlight is shown when DI+ or DI− increases sharply, either from a low-ADX environment or from a rapid standalone spike.
GAP Markers
Optional yellow label markers display the word "GAP" just below the lowest line (ADX, DI+, or DI−) whenever a gap condition is triggered. These provide a more noticeable visual cue without crowding the chart.
You can enable or disable the markers with the Show GAP Markers toggle.
🧠 Advanced Divergence Detection:
The script also scans for dominant ADX divergence events, where ADX is significantly higher than DI+ or DI−, indicating strong trend force with weak directional participation. When these conditions are met:
Red or green background fills appear depending on whether DI+ or DI− is being overpowered.
These conditions are based on customizable moving averages and DI strength relationships.
⚙️ Key Inputs:
🧪 Use Cases:
🔍 What It Does:
This indicator builds on the Average Directional Index (ADX) system to detect conditions where market trend strength diverges significantly from directional input (DI) activity. It includes two major visual signals:
Highlight Backgrounds
These appear when the indicator detects a “gap” or sudden acceleration in DI values while ADX remains low, suggesting early-stage momentum bursts or signal noise spikes.
The trigger threshold for DI change can be adjusted using the Gap Trigger Level input.
A background highlight is shown when DI+ or DI− increases sharply, either from a low-ADX environment or from a rapid standalone spike.
GAP Markers
Optional yellow label markers display the word "GAP" just below the lowest line (ADX, DI+, or DI−) whenever a gap condition is triggered. These provide a more noticeable visual cue without crowding the chart.
You can enable or disable the markers with the Show GAP Markers toggle.
🧠 Advanced Divergence Detection:
The script also scans for dominant ADX divergence events, where ADX is significantly higher than DI+ or DI−, indicating strong trend force with weak directional participation. When these conditions are met:
Red or green background fills appear depending on whether DI+ or DI− is being overpowered.
These conditions are based on customizable moving averages and DI strength relationships.
⚙️ Key Inputs:
- ADX Length: Period for ADX calculation
- DI Moving Average: Smoothing length for directional index signals
- Gap Trigger Level: Minimum DI change needed to trigger a GAP highlight
- Show Highlight Backgrounds: Toggle to display or hide background signals
- Show GAP Markers: Toggle to show or hide text-based GAP labels
🧪 Use Cases:
- Spot early breakouts or reversals when DI activity spikes while ADX is still low
- Identify periods of trend exhaustion or false breakouts using divergence logic
- Confirm trade entry points when ADX begins to rise after a GAP event
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.