Alxuse Stochastic RSI for tutorial 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © zarafshani20
//@version=5
indicator(title="Alxuse Stochastic RSI for tutorial ", timeframe="")
smoothK = input.int(3, "K", minval=1)
smoothD = input.int(3, "D", minval=1)
upper_Band = input(title = "Upper Band", defval = 95)
lower_Band = input(title = "Lower Band", defval = 5)
lengthRSI = input.int(14, "RSI Length", minval=1)
lengthStoch = input.int(14, "Stochastic Length", minval=1)
src = input(close, title="RSI Source")
rsi1 = ta.rsi(src, lengthRSI)
k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = ta.sma(k, smoothD)
plot(k, "K", color=color.red)
plot(d, "D", color=color.green)
h0 = hline(upper_Band, "Upper Band", color=color.new(#fc0202, 50))
hline(50, "Middle Band", color=color.new(#787B86, 50))
h1 = hline(lower_Band, "Lower Band", color=color.new(#fc0202, 50))
Buy_SRsi = ta.crossover(k, d) ? d : na
Sell_SRsi = ta.crossunder(k, d) ? d : na
plot(Buy_SRsi, title="Buy", color=color.green, style=plot.style_circles, linewidth=4)
plot(Sell_SRsi, title="Sell", color=color.red, style=plot.style_circles, linewidth=4)
Long_SRsi = Buy_SRsi and Buy_SRsi <= lower_Band
Short_SRsi = Sell_SRsi and Sell_SRsi >= upper_Band
plotchar(Long_SRsi, 'Long', '△', location.bottom, color.new(color.lime, 0), size=size.tiny)
plotchar(Short_SRsi, 'Short', '▽', location.top, color.new(color.red, 0), size=size.tiny)
alertcondition(Long_SRsi, 'Circle Green and Lower Band (Long)', 'Long, Crossover SRsi <= Lower Band')
alertcondition(Short_SRsi, 'Circle Red and Upper Band (Short)', 'Short, Crossunder >= Upper Band')
alertcondition(Buy_SRsi, 'Circle Green (Buy)', 'Buy, Crossover SRsi (Triangles Green)')
alertcondition(Sell_SRsi, 'Circle Red (Sell)', 'Sell, Crossunder SRsi (Triangles Red)')