Added custom bar colorization.
Updated color scheme based on PVI and NVI divergence strength.
Added optional smoothing to the script using an exponential moving average to filter noisy outputs.
Added a mode selection with three modes to choose from:
- Dual Index Mode, which displays the original DVDI
- Oscillator Mode, which displays the difference between the PVDI and NVDI as a centered oscillator
- Bar Counter Mode, which displays the number of bars in which volume divergence is in a positive dominant phase and negative dominant phase
Migrated code from pine v2 to pine v3.
Added a source price input.
Added an option to use tick volume rather than real volume. If the chart being analyzed has no real volume component, use tick volume.
Condensed DVDI's operations into a singular function for optimized performance.
Fixed a small issue with the bar counter.
Mode selection is now an easy to use dropdown menu.
Color schemes have been updated for greater detail.
-> Migrated to v4.
-> Updated DVDI function.
-> Corrected NaN values to stabilize initial conditions.
-> Reorganized script structure.
-> Revamped color scheme.
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.