Divergence for many indicator v3

Hello Everyone. Almost one year later, with Pine version 4, I developed new version of the Divergence for many Indicator.

It analyses divergences for 10 predefined indicators and then draws line on the graph. Red for negatif divergence (means prices may go down or trend reversal), Lime for positive divergences (means prices may go up or trend reversal)

Divergences version 2 has latency because it waits higher time frame completion. in this new version the script uses Pivot Points and on every bar it checks divergence between last Pivot point and current bar and if it finds any then immediately draws line and removes old one. so there is no latency with this version.

There are predefined 10 indicators in the script, you have option to choose which indicators the script would analyse for divergence. ( RSI , MACD , MACD Histogram, Stochastic , CCI , Momentum, OBV, Diosc, VWMACD and CMF )

In replay mode you can see how the script puts new divergence line and removes old one. you better see it for yourself by using replay mode.

Hope you Enjoy!

Release Notes: alert condition fixed
Release Notes: Added indicator names which has divergence! (optional and you must select it in the options menu)
Release Notes: "Minimum Number of Divergence" option added. by default it's value is 1.

if number of divergences is less than "Minimum Number of Divergence" then the script doesn't count it as divergence. for example if you set this to "2" then you will see then divergence line only if the number of divergence is equal or greater than "2".

I don't recommend to increase this number because sometimes divergence on only one indicator may show the trend reversal, so possible to miss trend reversal.
Release Notes: .
Release Notes: Money Flow Index (MFI) added as 11. indicator for divergence
Release Notes: Added "Change Width by Number of Divergence". If you enable this option then Line width changes by number of divergence. enabled by default.
Release Notes: Added "Check Cut-Through in indicators" option. disabled by default. if you enable this option and if there is cut-through in any indicator then it's not shown as valid divergence.
Release Notes: MAJOR UPDATE!

HIDDEN DIVERGENCES ADDED. not to make chart very crowded it shows Regular Divergence OR Hidden Divergence. if you select "Show Hidden Divergence" then it show ONLY Hidden once, if you unselect it then only Regular Ones are shown.

"Check Cut-Through in indicators" option was added. I recomment you to select/enable it. it checks there is cut-through in indicators or not, if no cut-through then it's shown as valid divergence.

Release Notes: A screenshot of Hidden Divergence:

Release Notes: Alerts added for Hidden Divergences
Ta bort från favoritskript Lägg till som favoritskript
If you find my works useful, please consider a donation
BTC: 19qDW9AShZhBZsGuXcgRzam5Fbpc3EU8EV
ETH: 0x39c8552371b9b7f4e324197af460ba8bc8e18ef9


Dear Sir,
Pls add the option so that both hidden and regular divergence can be used simultaneously.

Its working excellent!!

But Many time I have missed the reversals which was shown by hidden divergence,I cant use more than 3 indicators so its quite difficult to use this indicator two times.

Pls help !!
Nice BUT.. it would be good to get an explanation about why "hidden divergences" let the classical divergences vanish and what you mean with "cut-through in indicators". This isn't explained anywhere. Thank you.
Can someone please explain how to use this to newbies like me?

is the divergence based on wicks or closing prices?
Great work man!

I will check it out!

Thanks for sharing!
How about the option of using closing prices instead of wicks to draw the divergences? RSI div is supposed to use closing prices
+1 Svara
In row 202 you should change the color to this:
labh := DIVenable ? label.new(bar_index, na, text=txt, color= showhidden ? color.orange : color.red, textcolor = showhidden ? color.white : color.white, style= showhidden ? label.style_labelup : label.style_labeldown, yloc=yloc.abovebar) : na

Because it was confusing me in the beginning.
When i turned on the "Hidden", then it displayed "green" for "Hidden BEAR div".. I would suggest to change it to orange =) And the textcolor to white =)

And another question:
Is it possible that you add the possibility to display both at the same time? I think this would be then the BEST indicator so far on Tradingview if it could display hidden and regular at the same time.
Amazing one !! Will backtest it for a few weeks and let u know :)
Nice work man, thanks a lot. I'm wondering if these divergence signals can be drawn when the current bar is not closed?
Hem Aktie-screener Forex-screener Krypto-screener Ekonomisk kalender Hur det fungerar Diagramfunktioner Priser Tipsa en vän Ordningsregler Hjälpcenter Webbsidor och mäklarlösningar Widgets Diagramlösningar Lightweight Charting Library Blogg och nyheter Twitter
Profil Profilinställningar Konto och fakturering Tipsa en vän Mina kölappar Hjälpcenter Publicerade idéer Följare Följer Privata meddelanden Chatt Logga ut