Dual Volume Divergence Index

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

Dual Volume Divergence Index

Postby isamegrelo » Sun Feb 11, 2018 6:38 am

Code:


//@version=2
study(title="Dual Volume Divergence Index [DW]", shorttitle="DVDI [DW]")
//by Donovan Wall

//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 = input(255, minval=1, title="EMA Period")

//----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Definitions
//----------------------------------------------------------------------------------------------------------------------------------------------------------------

//Rate of Change
roc = roc(close, 1)

//Positive Volume Divergence Index
pvi = volume > volume[1] ? nz(pvi[1]) + roc : nz(pvi[1])
psig = ema(pvi, per)
pdiv = pvi - psig
pcolor = pvi > psig ? lime : pvi < psig ? red : na

//Negative Volume Divergence Index
nvi = volume < volume[1] ? nz(nvi[1]) - roc : nz(nvi[1])
nsig = ema(nvi, per)
ndiv = nvi - nsig
ncolor = nvi < nsig ? lime : nvi > nsig ? red : na

//Divergence Color
dcolor = (pdiv > ndiv) and (pdiv < 0) ? green : (pdiv > ndiv) and (pdiv > 0) ? lime : (ndiv > pdiv) and (ndiv < 0) ? maroon : (ndiv > pdiv) and (ndiv > 0) ? red : na

//Center
cent = 0

//----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Plots
//----------------------------------------------------------------------------------------------------------------------------------------------------------------

//Index Center
centplot = plot(cent, color=orange, title="Center Line")

//Index Plots
pplot = plot(pdiv, color=lime, title="PVI Divergence")
nplot = plot(ndiv, color=red, title="NVI Divergence")

//Fills
fill(pplot, nplot, color=dcolor, transp=60)

//Bar Colorization
barcolor(dcolor)
isamegrelo
FXCodeBase: Initiate
 
Posts: 114
Joined: Mon May 29, 2017 3:36 pm



Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 11 guests