Relative Strength Index - Divergences - Libertus

Published on MillionChart by AlphaHunter.

This script makes RSI easier to read by colouring overbought and oversold conditions, and as a bonus it shows bullish and bearish divergences over the last 50 candles. The lookback can be changed.

Features:
- RSI with colouring for overbought and oversold zones.
- Divergence detection: bullish and bearish divergences between price and RSI are displayed.
- Adjustable divergence lookback, 50 candles by default.

A divergence happens when price makes a new swing extreme but RSI does not confirm it. A bullish divergence is price making a lower low while RSI makes a higher low, and a bearish one is price making a higher high while RSI makes a lower high. These can warn that momentum is fading.

The script is open source, and part of the code is taken from standard example scripts. The author invites suggestions and improvements from the community.