Adaptation for Prorealtime of the Dual Volume Divergence Index, created by Donovan Wall for the Tradingview platform.
This is an experimental variation of Paul L. Dysart’s Positive Volume Index and Negative Volume Index that tracks the divergences between the PVI and its EMA, and the NVI and its EMA, then plots both together for comparison. This tool can be used to identify trending price activity.
REM DUAL VOLUME DIVERGENCE INDEX [DW]
//@version=2
//by Donovan Wall
//adapted for the Prorealtime platform by bolsatrilera
//This is an experimental variation of Paul L. Dysart's Positive Volume Index and Negative Volume Index that tracks the divergences between the PVI and its EMA, and the NVI and its EMA, then plots both together for comparison.
//This tool can be used to identify trending price activity.
//----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Inputs
//----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Period
//per = 255 // title="EMA Period"
//----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Definitions
//----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Rate of Change
rocc = roc[1](close)
//Positive Volume Divergence Index
if volume > volume[1] then
pvi= pvi[1]+rocc
else
pvi= pvi[0]
endif
psig = ExponentialAverage[per](pvi)
pdiv = pvi - psig
//Negative Volume Divergence Index
if volume <volume[1] then
nvi= nvi[1]-rocc
else
nvi= nvi[0]
endif
nsig = ExponentialAverage[per](nvi)
ndiv = nvi - nsig
//Center
cent = 0
return cent coloured (255,140,0)as "0", pdiv coloured(50,205,50)as "PVI Divergence",ndiv coloured(255,0,0)as"NVI Divergence"