indicator · own pane · open source
Positive Volume Index MA
Running…
Loading chart…
About
PVI with Moving Average adds a smoothed baseline on top of the Positive Volume Index — the standard 'above MA = trend up' read for the volume axis.
- PVI above its own MA = crowd participation supporting the move.
- PVI below its own MA = crowd participation fading; treat rallies cautiously.
Source code
//@version=5
indicator("Positive Volume Index MA", overlay=false)
len = input.int(14, "SMA length", minval=2, maxval=200)
var float pvi = 100
prev = na(pvi[1]) ? 100 : pvi[1]
pvi := volume > volume[1] ? prev * close / close[1] : prev
ma = ta.sma(pvi, len)
p_PVI = plot(pvi, "PVI", color=color.blue, linewidth=2)
p_PVI_MA = plot(ma, "PVI MA", color=color.orange, linewidth=2)
alertcondition(ta.crossover(pvi, ma), "PVI above MA", "Positive Volume Index crossed above its MA")
alertcondition(ta.crossunder(pvi, ma), "PVI below MA", "Positive Volume Index crossed below its MA")
No comments yet.
Sign in to comment.