Ultimate Divs On Any Indicator
Feb 6, 2022

The Ultimate Divs On Any Indicator tool identifies regular and hidden divergences between price action and a user-selected oscillator, utilizing candle close values for improved accuracy. Unlike standard divergence tools that often rely on candle highs/lows or look back only a single pivot, this script evaluates multiple historical pivots and ensures that intermediate price action does not intersect the divergence line, providing more robust signals.
Usage
The script can be applied to any indicator source (such as RSI, MACD, or OBV) to find momentum discrepancies. Examples of usage include:
- Regular Divergences: Used to identify potential trend reversals when price makes a higher high but the oscillator makes a lower high (Bearish), or price makes a lower low while the oscillator makes a higher low (Bullish).
- Hidden Divergences: Used to identify trend continuation opportunities.
- Multiple Pivot Lookback: The indicator scans back through multiple historical pivots to find valid divergences that standard scripts might miss due to their limited lookback depth.
- Potential Divergences: Real-time dashed lines indicate "potential" divergences before the current pivot is fully confirmed, allowing for earlier anticipation of moves.
Details
This implementation prioritizes candle close values rather than highs or lows. Since most oscillators are calculated using closing prices, comparing them against price extremes can create "false" divergences. By aligning the price data with the oscillator data (both using closes), the script ensures a more mathematically sound comparison. Additionally, the script includes an "Intersection Filter" which prevents the drawing of divergence lines if the price or oscillator breaks the trend line between the two identified pivots.
Settings
- Alert Options: Toggle visibility and alerts for Regular Bullish, Regular Bearish, Hidden Bullish, Hidden Bearish, and Potential Divergences.
- Plot Options: Choose whether to display divergence lines and labels, and whether to overlay the results on the main price chart or keep them on the indicator pane.
- Divergence Settings:
- Indicator: Select the source data/oscillator for divergence calculation.
- Lookback Range (Max/Min): Define the distance between pivots to be considered for a divergence.
- OB/OS Filt: Filter signals based on Overbought/Oversold levels (Off, On, or Strict).
- Colors: Customize the colors for all four divergence types.
FAQ
- How do I access this tool? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
- Why do some old divergence lines disappear? To maintain performance and adhere to platform limits, the script uses dynamic line objects. Older lines are automatically removed as new ones are generated to stay within the maximum line count.
- Can I use this on any timeframe? Yes, the indicator is designed to function across all timeframes and can be attached to any oscillator-style source.
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.