ta.nviNegative Volume Index
Negative Volume Index. Tracks proportional price changes on bars whose volume is lower than the preceding bar; it is not restricted to daily charts.
Syntax
ta.nviReturns
series float
Code Examples
//@version=6
indicator("Negative Volume Index")
plot(ta.nvi, color=color.yellow)
// the same on pine
f_nvi() =>
float ta_nvi = 1.0
float prevNvi = (nz(ta_nvi[1], 0.0) == 0.0) ? 1.0 : ta_nvi[1]
if nz(close, 0.0) == 0.0 or nz(close[1], 0.0) == 0.0
ta_nvi := prevNvi
else
ta_nvi := (volume < nz(volume[1], 0.0)) ? prevNvi + ((close - close[1]) / close[1]) * prevNvi : prevNvi
result = ta_nvi
plot(f_nvi())Trading Applications
Study price changes on lower-volume bars
Identify divergences between NVI and price
Use NVI/PVI pair for comprehensive volume analysis
Compare lower-volume and higher-volume price behavior without identifying participants
Related Functions
Frequently Asked Questions
Generate ta.nvi Code with AI
Draft Pine Script using ta.nvi with Pineify's AI Coding Agent, then review the arguments and test the result on your chart. Usage depends on your plan and available credits.
Related Pine Script Functions
ta.pvi - Positive Volume Index
Learn about ta.pvi in Pine Script. Track proportional price changes on bars with higher volume than the preceding bar.
ta.obv - On Balance Volume
Learn about ta.obv built-in variable in Pine Script. Access On Balance Volume for volume-based trend confirmation.
ta.pvt - Price-Volume Trend
Learn about ta.pvt built-in variable in Pine Script. Access Price-Volume Trend for percentage-weighted volume analysis.
ta.accdist - Accumulation/Distribution
Learn about ta.accdist built-in variable in Pine Script. Access the Accumulation/Distribution Index for money flow analysis.
ta.mfi() - Money Flow Index
Learn how to use ta.mfi() in Pine Script. Syntax, parameters, code examples for the volume-weighted RSI indicator.