OPEN-SOURCE SCRIPT
RVI with SMA Smoothing and Divergence Signals

This script enhances the Relative Volatility Index (RVI)—originally introduced by Donald Dorsey in 1993—by integrating three complementary analytical features:
1. SMA-based smoothing of the RVI line to reduce noise and clarify the underlying volatility momentum trend.
2. Automated detection of regular and hidden divergences between price action (highs/lows) and RVI pivots, using robust `ta.pivotlow` and `ta.pivothigh` logic with configurable lookback and search ranges.
3. Visual labels ("R" for regular, "H" for hidden) and color-coded pivot markers to help traders quickly identify potential reversal or continuation zones.
Unlike basic RVI implementations, this version is designed to highlight momentum-price decoupling, a key concept in technical analysis. The divergence engine is synchronized with RVI’s unique 0–100 scale and volatility-based calculation, ensuring signals are contextually relevant—not generic overlays.
How it works:
- RVI is computed using standard deviation of directional price changes, normalized to 0–100.
- A user-defined SMA (default: 14 periods) smooths the RVI for trend clarity.
- Divergences are confirmed only when both a valid price pivot and a corresponding RVI pivot occur within a configurable bar range (default: 5–60 bars).
- Hidden bearish divergences are disabled by default to reduce noise on short-term charts.
Suggested use:
- Regular bullish divergences near the 20 (oversold) level may signal exhaustion of a downtrend.
- Regular bearish divergences above 80 (overbought) can warn of upward momentum loss.
- Combine with price structure (support/resistance) for higher-probability setups.
This script is **not a simple mashup**: the integration of divergence logic with RVI’s volatility-based nature, parameterized sensitivity controls, and clean visualization provides a cohesive analytical tool not found in standard indicators.
> Disclaimer: This script is for educational and informational purposes only. It does not constitute financial, investment, or trading advice. Past performance is not indicative of future results.
—
Créditos:
- RVI concept: Donald Dorsey (1993)
- Divergence methodology: Standard technical analysis practice
- Implementation and enhancements: © Carlos Mauricio Vizcarra (2025)
- Licensed under MPL 2.0
1. SMA-based smoothing of the RVI line to reduce noise and clarify the underlying volatility momentum trend.
2. Automated detection of regular and hidden divergences between price action (highs/lows) and RVI pivots, using robust `ta.pivotlow` and `ta.pivothigh` logic with configurable lookback and search ranges.
3. Visual labels ("R" for regular, "H" for hidden) and color-coded pivot markers to help traders quickly identify potential reversal or continuation zones.
Unlike basic RVI implementations, this version is designed to highlight momentum-price decoupling, a key concept in technical analysis. The divergence engine is synchronized with RVI’s unique 0–100 scale and volatility-based calculation, ensuring signals are contextually relevant—not generic overlays.
How it works:
- RVI is computed using standard deviation of directional price changes, normalized to 0–100.
- A user-defined SMA (default: 14 periods) smooths the RVI for trend clarity.
- Divergences are confirmed only when both a valid price pivot and a corresponding RVI pivot occur within a configurable bar range (default: 5–60 bars).
- Hidden bearish divergences are disabled by default to reduce noise on short-term charts.
Suggested use:
- Regular bullish divergences near the 20 (oversold) level may signal exhaustion of a downtrend.
- Regular bearish divergences above 80 (overbought) can warn of upward momentum loss.
- Combine with price structure (support/resistance) for higher-probability setups.
This script is **not a simple mashup**: the integration of divergence logic with RVI’s volatility-based nature, parameterized sensitivity controls, and clean visualization provides a cohesive analytical tool not found in standard indicators.
> Disclaimer: This script is for educational and informational purposes only. It does not constitute financial, investment, or trading advice. Past performance is not indicative of future results.
—
Créditos:
- RVI concept: Donald Dorsey (1993)
- Divergence methodology: Standard technical analysis practice
- Implementation and enhancements: © Carlos Mauricio Vizcarra (2025)
- Licensed under MPL 2.0
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.