RelativeVolatilityIndex — Relative Volatility Index
תוכן זה אינו זמין עדיין בשפה שלך.
RSI computed on standard deviation instead of price: is volatility itself trending up or down? Dorsey proposed it as a confirmation filter — a price breakout with rising RVI has participation behind it.
Signature
RelativeVolatilityIndex(period, stdev_period, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
period |
int Param or literal | Yes | RSI smoothing over the σ changes. Default 14, bounds 1–200. |
stdev_period |
int Param or literal | Yes | Standard-deviation window. Default 10, bounds 2–200. |
on= |
symbol, OHLCV field, or indicator | No | Source. Defaults to the trade symbol’s close. |
Formula
$$ \text{RVI} = 100,\frac{\text{avg gain}(\Delta\sigma)}{\text{avg gain}(\Delta\sigma) + \text{avg loss}(\Delta\sigma)} $$
with the averages Wilder-smoothed over period.
Warmup
stdev_period + period bars; 50 until then, and 50 when σ has not moved at all.
Reading the value
rvi.valuervi > 50Example
class RviConfirm(Strategy): """Take breakouts only when volatility is expanding with them.""" trade = Symbol() sizing = FixedCapital()
def execute(self): rvi = RelativeVolatilityIndex(14, 10, on=self.trade) dh = DonchianHighTrue(20, on=self.trade) if self.trade.close >= dh.value_at(1) and rvi.value > 50 and self.trade.is_flat: self.buy(self.trade, reason=f"Breakout, RVI {rvi.value:.0f}") if rvi.value < 40 and self.trade.is_long: self.sell(self.trade, self.trade.position, reason="Volatility fading")Notes
- Donald Dorsey, TASC (1993).
- Proven by an assert-via-trade run on SPY daily (stayed inside 0–100 on every bar of a 140-bar run; zero alarm trades).
- Not the same as
RelativeVigorIndex, which measures candle bodies — the shared abbreviation is an unfortunate accident of the literature.