Code Library / RSI Strategies
Pine Script Stochastic RSI
Stochastic RSI for precise entry signals on TradingView.
Language: Pine Script · Category: RSI Strategies · Tags: stochastic RSI, Pine Script, strategy, oscillator, precise entries
Source code
//@version=5
strategy("StochRSI",overlay=true)
rsi=ta.rsi(close,14); sr=ta.stoch(rsi,rsi,rsi,14)
k=ta.sma(sr,3); d=ta.sma(k,3)
if ta.crossover(k,d) and k<20
strategy.entry("Long",strategy.long)
if ta.crossunder(k,d) and k>80
strategy.entry("Short",strategy.short)How to use this snippet
This is a building block, not a finished trading system. Paste it into your own Pine Script project, compile it, and test it on a demo account with your broker's real spreads before relying on it. You can convert it to MQL4 or MQL5 with the Pine Script converter.