VolumePine Script v6Built-in Variable

ta.nvi

Negative 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

Generate ta.nvi Code with AI

Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.nvi and other built-in functions instantly.