Files
QuanTAlib/lib/volume/pvr/pvr.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

26 lines
773 B
Plaintext

// The MIT License (MIT)
// © mihakralj
//@version=6
indicator("Price Volume Rank (PVR)", "PVR", overlay=false)
//@function Calculates Price Volume Rank
//@param price Price series for comparison
//@param vol Volume series for comparison
//@returns Price Volume Rank (0-4)
//@optimized for performance and dirty data
pvr(series float price, series float vol=volume) =>
float p = nz(price, close), float v = nz(vol, 0.0)
float pp = nz(p[1], p), float pv = nz(v[1], v)
p > pp ? (v > pv ? 1 : 2) : p < pp ? (v < pv ? 3 : 4) : 0
// ---------- Main loop ----------
// Inputs
i_price_source = input.source(close, "Price Source")
// Calculation
pvr_value = pvr(i_price_source)
// Plot
plot(pvr_value, "PVR", color=color.yellow, linewidth=2, plot.style_stepline)