feat: add new indicators (Decay, Edecay, MinusDi, MinusDm, PlusDi, PlusDm, Maxindex, Minindex, Sarext) and update pine scripts, core libs, validation tests, and python bindings
2026-03-09 13:45:46 -07:00
|
|
|
// Licensed under the Apache License, Version 2.0
|
2026-01-18 19:02:03 -08:00
|
|
|
// © 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
|
fix(docs): correct .md documentation across errors, dynamics, filters, forecasts, momentum, numerics, oscillators, reversals, statistics, trends, volatility, volume
2026-03-10 18:38:23 -07:00
|
|
|
plot(pvr_value, "PVR", color=color.yellow, linewidth=2, style=plot.style_stepline)
|