Divergence IQ
Mar 4, 2025

The Divergence IQ indicator is a comprehensive toolkit designed to detect and backtest divergences between price action and almost any technical indicator. By identifying regular and hidden divergences, this tool helps traders spot potential trend reversals and continuation patterns while providing built-in trade simulation to assess strategy effectiveness.
Usage
To use the indicator, select your desired technical indicator as the source (e.g., RSI, OBV, or MACD). The tool will then scan for bullish or bearish divergences based on your chosen detection method.
Divergence Detection Methods
- Pivot Detection: Uses classic pivot point analysis (Highs/Lows) to find well-defined divergences. This method is highly accurate but requires a "lookahead" period for confirmation, resulting in slight lag.
- Immediate Detection: Aimed at reducing lag, this mode signals a divergence as soon as the most recent price action deviates from the indicator trend, often triggering just one bar after the occurrence.
Normalization
The script features multiple normalization techniques—Robust Scaling, Rolling Z-score, and Rolling Min-Max. These allow non-oscillating indicators (like OBV or Volume) to be converted into an oscillator format, making divergence detection more intuitive and visually clear.
Details
Divergence IQ operates by comparing the highs and lows of price action against the corresponding peaks and troughs of the selected indicator. If price makes a higher high while the indicator makes a lower high, a bearish divergence is flagged.
The "Immediate Detection" logic is a unique implementation that uses pivots for the historical point but real-time price action for the signal point, allowing for faster alerts without the typical repainting issues associated with pivot-based indicators. The integrated backtesting engine uses standard properties like 5% equity per trade and conservative commissions to give a realistic view of how a specific divergence strategy might perform on a given asset.
Settings
Divergence Detection Setup
- Indicator: Select the technical indicator source for comparison.
- Divergence Detection Method: Choose between Pivot-based or Immediate detection.
- Use Closing Prices: When enabled, the script uses closing prices instead of Highs/Lows for detection.
- Left Lookback / Right Lookahead: Adjusts the sensitivity and confirmation window for pivot points.
Normalization
- Normalize Indicator: Choose the scaling algorithm (None, Robust Scaling, Z-score, or Min-Max).
- Normalization Window: Defines the lookback period used for scaling calculations.
Strategy & Visuals
- Stop Loss & Target Type: Toggle between ATR-based or Percentage-based exit levels.
- Profit Target / Stop Loss Multiplier: Set the distance for simulated trade exits.
- Show Divergences On Price: Displays labels and lines directly on the price chart.
- Show Gradient Flow: Visualizes the momentum flow between price and indicator.
FAQ
How do I access Divergence IQ? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Can I use this with custom indicators? Yes, by using the "Source" input, you can link Divergence IQ to the output of other indicators loaded on your chart.
Does this indicator repaint? When using "Pivot Detection," signals appear after the "Right Lookahead" period is completed. The "Immediate Detection" mode is designed to signal on the close of the bar following the divergence to ensure the signal remains fixed.
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.