VolumePine Script v6Built-in Variable

ta.nviNegative Volume Index

Negative Volume Index. Tracks price changes on days when volume decreases from the previous day.

Syntax

Syntax
ta.nvi

Returns

series float

Code Examples

Pine Script v6 Example
//@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

Track smart money activity on low-volume days

Identify divergences between NVI and price

Use NVI/PVI pair for comprehensive volume analysis

Detect institutional accumulation patterns

Related Functions

Frequently Asked Questions

ta.nvi is the Negative Volume Index: a cumulative index that updates on bars where volume is lower than the prior bar, based on the proportional price change.

The classic idea is that informed participants may trade on lower-volume days; NVI focuses on price changes when volume drops, separate from crowd-driven high-volume days (PVI).

Compare both: NVI for low-volume price behavior and PVI for high-volume behavior. Cross-check trends and divergences with price for a fuller volume picture.

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.