NegativeVolumeIndex — Negative Volume Index
תוכן זה אינו זמין עדיין בשפה שלך.
A cumulative index that changes only on falling-volume bars. Fosback’s theory is that the quiet days are when informed money positions itself, so NVI tracks the smart money and PVI tracks the crowd.
Signature
NegativeVolumeIndex(period, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
period |
int Param or literal | Yes | SMA smoothing of the index. 1 returns the raw index. Bounds 1–200. |
on= |
symbol | No | Source symbol. Defaults to the trade symbol. Reads close and volume. |
Formula
$$ \text{NVI}t = \begin{cases}\text{NVI}{t-1}\left(1 + \frac{C_t - C_{t-1}}{C_{t-1}}\right) & V_t < V_{t-1} \ \text{NVI}_{t-1} & \text{otherwise}\end{cases} $$
Warmup
Starts at 1000 (the conventional base) and accumulates; resets per run.
Reading the value
nvi.valuenvi.value > ema.valueExample
class SmartMoneyFilter(Strategy): """Fosback's read: long while NVI is above its own long average.""" trade = Symbol() sizing = FixedCapital()
def execute(self): nvi = NegativeVolumeIndex(1, on=self.trade) base = EMA(255, on=nvi) if nvi.value > base.value and self.trade.is_flat: self.buy(self.trade, reason="NVI above its base") if nvi.value < base.value and self.trade.is_long: self.sell(self.trade, self.trade.position, reason="NVI below its base")Notes
- Norman Fosback, Stock Market Logic (1976). The 1000 starting value and the 255-day EMA comparison are his.