Skip to content
All library documents

Measuring RSI Divergence Magnitude Across Multiple Lookback Lengths

Article TradingView scripts

Summary

This indicator measures potential divergence between a price series and RSI across a configurable range of lookback lengths. For each length, it checks whether price and RSI move in opposite directions and rejects cases where the straight line between the endpoints crosses either series. It scales the absolute changes using a stochastic projection, sums the valid measurements, and averages them across the selected lengths. The histogram color identifies regular bullish or bearish divergence and their hidden variants.

The document explains the calculation and its adjustable RSI and divergence lengths, and notes that a zero reading means no divergence was detected within the configured range. It does not provide performance tests or evidence that larger readings predict a stronger reversal; the author explicitly cautions that magnitude need not affect the chance of follow-through. Readings can also reflect divergences that are still forming and may later disappear or grow. The script includes stricter checks for extrema and line position, but these are unused because they removed too many otherwise useful detections.

Key ideas

  • The indicator evaluates price and RSI over multiple configurable lookback lengths.
  • A candidate divergence requires opposite endpoint changes and no crossing of either series by its connecting line.
  • Price and RSI changes are normalized before valid magnitudes are combined into an averaged histogram.
  • Colors distinguish regular bullish and bearish divergence from hidden bullish and bearish divergence.
  • A zero reading indicates no detected divergence within the chosen lengths, while nonzero readings do not establish predictive strength.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.