Untitled Document
Untitled Document
// Input parameters
RSI_period = input.int(10, "RSI Period", minval=1, maxval=1000)
RSI_average = input.string("SMA", "RSI Average", options=["SMA", "EMA", "WMA"])
RSI_title = input.string("close", "RSI Source", options=["open", "high", "low",
"close"])
RSI_OVB1 = input.float(50, "RSI OVB1", minval=0.01, maxval=100)
RSI_OVB2 = input.float(70, "RSI OVB2", minval=0.01, maxval=100)
RSI_OVS1 = input.float(50, "RSI OVS1", minval=0.01, maxval=100)
RSI_OVS2 = input.float(30, "RSI OVS2", minval=0.01, maxval=100)
// RSI Calculation
delta = ta.change(close)
up = ta.rma(math.max(delta, 0), RSI_period)
down = ta.rma(math.max(-delta, 0), RSI_period)
RS = up / down
RES = 100 - (100 / (1 + RS))
// Bands Calculation
middle = ta.sma(hlc3, MaTrend_period)
offset = ta.rma(ta.tr, MaTrend_period) * shift
upper = middle + offset
lower = middle - offset
// Plotting Bands
plot(upper, "Upper Band", color=color.new(colorTrend, 80), linewidth=1,
style=plot.style_line)
plot(lower, "Lower Band", color=color.new(colorTrend, 80), linewidth=1,
style=plot.style_line)