0% found this document useful (0 votes)
67 views1 page

Stochastic RSI Pine Script v5 Guide

This document is a Pine Script code for a Stochastic RSI indicator used in trading analysis. It includes inputs for RSI and Stochastic lengths, smoothing parameters, and plots the %K and %D lines along with overbought and oversold levels. Additionally, it generates buy and sell signals based on crossover conditions and sets up alerts for these conditions.

Uploaded by

solijon.j.bscs
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views1 page

Stochastic RSI Pine Script v5 Guide

This document is a Pine Script code for a Stochastic RSI indicator used in trading analysis. It includes inputs for RSI and Stochastic lengths, smoothing parameters, and plots the %K and %D lines along with overbought and oversold levels. Additionally, it generates buy and sell signals based on crossover conditions and sets up alerts for these conditions.

Uploaded by

solijon.j.bscs
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

//@version=5

indicator("Stochastic RSI", overlay=false)

// Inputs
rsi_length = [Link](14, "RSI Length")
stoch_length = [Link](14, "Stochastic Length")
k_smooth = [Link](3, "%K Smoothing")
d_smooth = [Link](3, "%D Smoothing")

// Calculate Stochastic RSI


rsi = [Link](close, rsi_length)
stoch_rsi = [Link](rsi, rsi, rsi, stoch_length)
k = [Link](stoch_rsi, k_smooth)
d = [Link](k, d_smooth)

// Plot lines
plot(k, color=[Link], title="%K", linewidth=2)
plot(d, color=[Link], title="%D", linewidth=2)

// Plot levels
hline(80, "Overbought", color=[Link], linestyle=hline.style_dashed)
hline(20, "Oversold", color=[Link], linestyle=hline.style_dashed)
hline(50, "Midline", color=[Link])

// Signals
oversold_cross = [Link](k, 20) and d < 20
overbought_cross = [Link](k, 80) and d > 80

// Plot signals
plotshape(oversold_cross, style=[Link], location=[Link],
color=[Link], textcolor=[Link], text="BUY")
plotshape(overbought_cross, style=[Link], location=[Link],
color=[Link], textcolor=[Link], text="SELL")

// Background
bgcolor(k > 80 and d > 80 ? [Link]([Link], 90) : k < 20 and d < 20 ?
[Link]([Link], 90) : na)

// Alerts
alertcondition(oversold_cross, "StochRSI Oversold", "StochRSI crossed above
oversold level")
alertcondition(overbought_cross, "StochRSI Overbought", "StochRSI crossed below
overbought level")

You might also like