Divergence

Calculates a divergence between 2 series
bullish(_src, _low, depth) Calculates bullish divergence
Parameters:
_src: Main series
_low: Comparison series (`low` is used if no argument is supplied)
depth: Fractal Depth (`2` is used if no argument is supplied)
Returns: 2 boolean values for regular and hidden divergence
bearish(_src, _high, depth) Calculates bearish divergence
Parameters:
_src: Main series
_high: Comparison series (`high` is used if no argument is supplied)
depth: Fractal Depth (`2` is used if no argument is supplied)
Returns: 2 boolean values for regular and hidden divergence
I created this library to plug and play divergences in any code.
You can create a divergence indicator from any series you like.
Fractals are used to pinpoint the edge of the series. The higher the depth, the slower the divergence updates get.
My Plain Stochastic Divergence uses the same calculation. Watch it in action.

Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.
Automate TradingView Alerts
tradingview.to/anywhere
🥰😍😍🥰😍😍🥰😍😍🥰
Declinazione di responsabilità
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.
Automate TradingView Alerts
tradingview.to/anywhere
🥰😍😍🥰😍😍🥰😍😍🥰