OPEN-SOURCE SCRIPT

RVI Divergence Detector with Custom SMA Filter (v6)

127
This script enhances the classic Relative Vigor Index (RVI) by integrating divergence detection with a user-configurable SMA filter applied directly to the RVI oscillator. The goal is to help traders identify high-probability reversal and continuation signals by combining momentum analysis with dynamic baseline filtering.

How it works:
- The RVI measures the conviction behind price moves by comparing closing vs. opening prices relative to the high-low range over a 10-period window.
- Divergences are detected when price makes a new high/low but the RVI does not:
- Regular Bullish: Price makes a lower low, RVI makes a higher low → potential reversal up.
- Hidden Bullish: Price makes a higher low, RVI makes a lower low → trend continuation.
- Inverse logic applies for bearish cases.
- A customizable SMA (default: 14 periods) is plotted on the RVI line. This acts as a dynamic reference to assess whether divergences occur in strong momentum zones (far from SMA) or neutral zones (near SMA), helping filter out weaker signals.
- Users can adjust:
- Pivot lookback range (min/max bars)
- SMA period (1–200)
- Visibility of bullish/bearish and hidden/regular divergences

Why this version adds value:
Unlike basic RVI scripts, this adaptation introduces a configurable trend filter (SMA) and clear visual labeling ("D" for regular, "H" for hidden) with colored lines (green/red) connecting oscillator and price pivots—making divergences instantly recognizable. The logic is optimized for both scalping (short SMA) and swing trading (longer SMA).

Credits:
Based on the original RVI divergence concept by madoqa. This is an open-source adaptation under the Mozilla Public License 2.0. No financial advice. Use at your own risk.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。