To ease everyone's trading experience I made this script which colors overbought and oversold conditions and as a bonus displays or divergences in last 50 candles (by default, you can change it).
Script is open source, part of code is from Trading View examples. If you have suggestions or you already made some improvements, please report in comment.
Happy trading and good luck!
Now divergences are shown for whole history.
Be warned that I increased lookback period to 90 bars by default. This is good for time frames up to 4H, even 4H in on the edge here.
Higher time frames then 4H probably need lower lookback period.
Please report any problems you encounter.
- ability to remove pivots
- ability to display smaller/shorter labels
- adapted script to new pine language version (v4)
- removed 8 n/a value that were cluttering indicator interface next to RSI value (only possible with v4 pine language)
- added option to have colored indicator background instead of BULL/BEAR labels
If you don't want separate indicator for RSI divergences, you can use my RSI Divergences - Candle edition:
If you want OBV divergences script, check out:
Some code cosmetics.
In real world that mean anything between few seconds after candle close or whole candle time, depending when price meets condition. Pivot is provided after 2 candles, but that isn't important for divergences.