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
オープンソーススクリプト
TradingViewの精神に則り、この作者はスクリプトのソースコードを公開しているので、その内容を理解し検証することができます。作者に感謝です!無料でお使いいただけますが、このコードを投稿に再利用する際にはハウスルールに従うものとします。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、この作者はスクリプトのソースコードを公開しているので、その内容を理解し検証することができます。作者に感謝です!無料でお使いいただけますが、このコードを投稿に再利用する際にはハウスルールに従うものとします。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。