Divergence Stoch RSI
Feb 5, 2020

The Divergence Stoch RSI indicator is a technical analysis tool that automatically identifies and labels regular and hidden divergences between price action and the Stochastic RSI oscillator. This tool helps traders pinpoint potential trend reversals and continuation signals by highlighting discrepancies in momentum.
Usage
The indicator can be used to identify four distinct types of divergence signals, which are plotted directly on the oscillator pane:
- Regular Bullish Divergence: Indicated by a "D" navy/green label. This occurs when the price makes a lower low, but the Stochastic RSI makes a higher low, suggesting a potential upward reversal.
- Hidden Bullish Divergence: Indicated by an "H" navy/green label. This occurs when the price makes a higher low, but the Stochastic RSI makes a lower low, suggesting a trend continuation to the upside.
- Regular Bearish Divergence: Indicated by a "D" red label. This occurs when the price makes a higher high, but the Stochastic RSI makes a lower high, suggesting a potential downward reversal.
- Hidden Bearish Divergence: Indicated by an "H" red label. This occurs when the price makes a lower high, but the Stochastic RSI makes a higher high, suggesting a trend continuation to the downside.
Traders can use these signals to complement their existing strategies, specifically looking for regular divergences at exhaustion points and hidden divergences during pullbacks within an established trend.
Details
The script calculates the Stochastic RSI based on a user-defined source and period. It then identifies pivot highs and lows within the oscillator to compare them against the corresponding price action. A "lookback range" is employed to ensure that the divergences identified occur within a relevant timeframe, preventing signals from being generated between pivots that are too far apart or too close together. The inclusion of "smooth K" and "smooth D" parameters allows for a cleaner oscillator output, reducing noise and potentially filtering out false divergence signals.
Settings
StoRSI Settings
- StoRSI Period: Sets the lookback period for the RSI calculation used within the Stochastic formula.
- StoRSI Source: Determines the price data used for calculation (e.g., Close, Open, High, Low).
- smoothK: Sets the slowing/smoothing factor for the %K line.
- smoothD: Sets the moving average period for the %D line.
Divergence Settings
- Pivot Lookback Right: The number of bars to the right of a pivot to confirm its peak or trough.
- Pivot Lookback Left: The number of bars to the left of a pivot to confirm its peak or trough.
- Max of Lookback Range: The maximum distance (in bars) allowed between two pivots to qualify for a divergence.
- Min of Lookback Range: The minimum distance (in bars) allowed between two pivots to qualify for a divergence.
Visibility Settings
- Plot Bullish: Toggles the visibility of Regular Bullish divergence signals.
- Plot Hidden Bullish: Toggles the visibility of Hidden Bullish divergence signals.
- Plot Bearish: Toggles the visibility of Regular Bearish divergence signals.
- Plot Hidden Bearish: Toggles the visibility of Hidden Bearish divergence signals.
FAQ
How do I access Divergence Stoch RSI?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
What is the difference between "D" and "H" labels?
"D" stands for Regular Divergence, which typically signals a potential trend reversal. "H" stands for Hidden Divergence, which typically signals a potential trend continuation.
Can I set alerts for these signals?
Yes, the script includes built-in alert conditions for all four types of divergences, which can be configured through the TradingView Alerts menu.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.