[EDU] RSI Momentum Bands
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © tarasenko_

//@version=5
indicator("RSI Momentum Bands")


// Inputs
p = input(14, "RSI Period")
mp = input(4, "1st RSI MA Period")
ma_p = input(50, "2nd RSI MA Period")
bm = input.float(1.0, "Band Mult", step = 0.1)


// Calculations
rsi = ta.ema(ta.rsi(close, p), mp)
ma_rsi = ta.wma(rsi, ma_p)

std = ta.stdev(ma_rsi, ma_p)

ub = ma_rsi + bm * std
lb = ma_rsi - bm * std
col = rsi > ub ? color.lime : rsi < lb ? color.red : color.black


// Plottings
RSI = plot(rsi, "RSI", col, 3)
plot(ma_rsi, "MA RSI", color.white)
U = plot(ub, "UB", color.gray)
L = plot(lb, "LB", color.gray)
fill(RSI, U, rsi > ub ? #00e67675 : na)
fill(RSI, L, rsi < lb ? #ff525275 : na)
barcolor(col)
