PositiveVolumeIndex

Calculates the Positive Volume Index indicator.

Accepts the following parameters:

Parameter NameTypeDefault ValueNotes
applyToSeries<Number>
close
-

Returns: Series<Number>

PositiveVolumeIndex is a built-in function - you can use it directly. Below is an example implementation:

1234
function PositiveVolumeIndex(applyTo = close):
series pvi: once: 100 if isknown volume and isknown applyTo else unknown then: pvi[1] + (applyTo - applyTo[1]) / applyTo[1] * pvi[1] if volume > volume[1] else pvi[1]