Files
QuanTAlib/lib/volume/pvi/pvi.pine
T
Miha Kralj 24e86d762a Add documentation links for various volatility indicators and channels
- Updated BBWN, BBWP, CCV, CV, CVI, EWMA, GKV, HLV, HV, Jvolty, JVOLTYN, MASSI, NATR, RSV, RV, RVI, TR, UI, VOV, VR, YZV indicators with documentation links.
- Added documentation links for Aberration, Acceleration Bands, Andrews' Pitchfork, Adaptive Price Zone, ATR Bands, Bollinger Bands, Center of Gravity, Donchian Channels, Decay Min-Max Channel, Detrended Synthetic Price, EACP, EBSW, HOMOD, Jurik Volatility Bands, Keltner Channel, MA Envelope, Min-Max Channel, Price Channel, Regression Channels, Standard Deviation Channel, Stoller Average Range Channel, Super Trend Bands, Ultimate Bands, Ultimate Channel, VWAP Bands, and VWAP with Standard Deviation Bands.
2026-02-18 11:55:48 -08:00

27 lines
891 B
Plaintext

// The MIT License (MIT)
// © mihakralj
//@version=6
indicator("Positive Volume Index (PVI)", "PVI", overlay=false)
//@function Calculates Positive Volume Index, tracks price changes on days with higher volume
//@param src Price series to use for calculation
//@param vol Volume series
//@param start_value Starting value for PVI (typically 100 or 1000)
//@returns float The PVI value
pvi(series float src, series float vol = volume, simple float start_value = 100.0) =>
var float pvi_value = start_value
if not (na(src) or na(vol) or na(src[1]) or na(vol[1]) or src[1] == 0.0 or vol[1] <= 0.0) and vol > vol[1]
pvi_value := pvi_value * src / src[1]
pvi_value
// ---------- Main Calculation ----------
// Parameters
src = input.source(close, "Price Source")
// Calculations
pvi_line = pvi(src, volume)
// Plot
plot(pvi_line, "PVI", color=color.yellow, linewidth=2)