Price Divergence Detector V3 revised by JustUncleL

This is a revised version of the original "Price Divergence Detector by RicardoSantos".
Price Divergence detection for various methods : RSI , MACD , STOCH , VOLUME , ACC-DIST, FISHER, CCI , BB %B and Ehlers IdealRSI. Both Hidden and Regular Divergences are detected.

Revision 3.0 by JustUncleL
  • Added option to disable/enable Hidden and Regular Divergence
  • Added new divergence method BB %B (close only)
  • Added new divergence mothos Ehlers IdealRSI (close only)

Revision 2.0 - by RicardoSantos

Information on Divergence Trading:
  • http://www.babypips.com/school/high-school/trading-divergences
  • http://www.incrediblecharts.com/indicators/bollinger_percentage_b_band_width.php (BB %B)

Release Notes: Updated to Revision 3 of Pinescript
Updated with some RicardoSantos version 2.022 revisions.
Release Notes: ..
Added Elders Force Index method.
Other small changes.
Release Notes: 3.2 Update
  • Added Trend Volume Accumulation, this option really works only well with Renko and HA candles. You have the option to use EMA for trend direction change instead of candle bull/bear direction.
  • NOTE: Trader discretion is required to manually filter out invalid Divergence, there is no account made for the length of each trend when comparisons are made.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


I'm a bit unclear on what the 'R' and the 'H' stand for. Could anybody explain what those imply? I'm trying to use this for RSI divergence.
+26 Reply
JustUncleL iper404
@iper404, They stand for Regular and Hidden divergence markers.
+9 Reply
I need script can alert every time signal R + H appear, Can you help me sort out it ?
+11 Reply
egsand diemtuvongoc
@diemtuvongoc, i can do that for this and other indicators
+6 Reply
@egsand, i need it too, can you help me out?
+1 Reply
Very nice!

How can i make it show each divergences at the same time? currently you can only choose one indicator at a time
+6 Reply

I like this script.
Thank you very much for making this script.

Sometimes i notice there is divergence which is not recognized by the script, for example :

Thank you.
+2 Reply
JustUncleL RedAndBlue
@RedAndBlue, It's quite difficult to make a script 100% accurate to what the human eyes can see. The trouble in the above example for a mechanical indicator is there are lots of peeks in Price and RSI, but the mechanical finder only looks at the last two fractal peeks, making the start point at a bit further on at the next smallish peek, so no divergence. I may look at trying to improve the indicator at a later date.
+2 Reply
RedAndBlue JustUncleL
@JustUncleL, thank you very much.
+1 Reply
Here is a link to the original R2 release by RicardoSantos:
+2 Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Private Messages Chat Sign Out