OPEN-SOURCE SCRIPT
Updated Stochastic RSI by Rohit

The "Stochastic RSI by Rohit Gupta" indicator aims to provide a Stochastic RSI with smoothed %K and %D lines and an additional line for their difference.
Release Notes
The "Stochastic RSI by Rohit Gupta" indicator aims to provide a Stochastic RSI with smoothed %K and %D lines and an additional line as R for their difference.It can be treated as near to Top & near to Bottom indicator for good large capital stocks.
Release Notes
Example:If %K = 70 and %D = 65, then R = 65 - 70 = -5. This negative R value indicates bearish momentum, as the faster %K is above the slower %D, suggesting the market may be losing upward momentum or entering a downtrend.
Practical Application
Trading Signals:
Bullish: A trader might consider entering a long position when R crosses above 0, especially if the Stochastic RSI is rising from the oversold region (below 20). Confirmation from price action or other indicators (e.g., support levels, moving averages) is recommended.
Bearish: A trader might consider exiting a long position or entering a short position when R crosses below 0, particularly if the Stochastic RSI is falling from the overbought region (above 80). Again, confirmation with other signals is advisable.
Context Matters: The R line is not a standalone indicator. Its signals are most effective when combined with:
The absolute levels of %K and %D (e.g., overbought > 80, oversold < 20).
Price action (e.g., breakouts, support/resistance levels).
Other technical indicators (e.g., moving averages, MACD, volume).
Limitations:
The R line is a derivative of %K and %D, so it may lag price movements, especially in volatile markets like Bitcoin.
False signals can occur in choppy or sideways markets, where %K and %D oscillate frequently, causing R to fluctuate around zero.
The R line is not a standard component of the Stochastic RSI, so its reliability depends on the specific market and timeframe.
Visual Representation
To illustrate, consider the Stochastic RSI plotted with %K, %D, and R lines:
Bullish Scenario: %K rises sharply, crosses above %D, and R turns positive. The green R line (as defined in the Pine Script with color #00ff40) moves above the zero line, signaling potential buying opportunities.
Bearish Scenario: %K peaks and crosses below %D, and R turns negative. The green R line drops below zero, indicating potential selling opportunities.
Example in Context (BTC Daily Timeframe)
Using the backtesting script provided in the previous response:
Bullish Example: On a day when Bitcoin’s Stochastic RSI shows %K crossing above %D (e.g., %K = 55, %D = 50, R = 50 - 55 = -5 transitioning to %K = 60, %D = 58, R = 58 - 60 = -2, and then to R > 0), a bullish signal is generated. This might coincide with a price breakout above a resistance level.
Bearish Example: If %K crosses below %D (e.g., %K = 75, %D = 80, R = 80 - 75 = 5 transitioning to %K = 78, %D = 76, R = 76 - 78 = -2), a bearish signal is generated, potentially aligning with a price drop below a support level.
Conclusion
The R line in the "Stochastic RSI by Rohit" indicator is bullish when positive (R > 0, %D > %K), indicating strengthening upward momentum, and bearish when negative (R < 0, %K > %D), suggesting weakening bullish momentum or a potential downtrend. Crossovers of R above or below zero can serve as actionable signals, particularly when aligned with overbought/oversold levels or other technical indicators. However, traders should use the R line cautiously, as it is a non-standard metric and may require validation through backtesting (as provided in the Python script) and confirmation with other market signals. If you need further clarification or examples specific to historical data, please let me know.
Release Notes
Updated the alignment with K variable which is the bullish sentiment.Release Notes
Rollbacking the previous changeOpen-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.