Amazing Oscillator [Algoalpha]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Algoalpha X © SUSHIBOI77

//@version=5
indicator("🙌 Amazing Oscillator [Algoalpha]")
Length = input.int(20, minval = 1)
green = input.color(#00ffbb, "Up Color") //#00ffbb
red = input.color(#ff1100, "Done Color") //#ff1100

ao = ta.sma(hl2,5) - ta.sma(hl2,34)
 
////////////////////////// RSI
up = ta.rma(math.max(ta.change(ao), 0), Length)
down = ta.rma(-math.min(ta.change(ao), 0), Length)
rsi = (down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))) - 50
transcon = (rsi > 30) or (rsi < -30) ? 0 : 0
fillcol = rsi > 0 ? color.new(green, transcon) : color.new(red, transcon)

z = plot(rsi, color = rsi > 0 ? color.new(green, transcon) : color.new(red, transcon), style = plot.style_columns)
plot(30, color = color.new(red, 80))
plot(-30, color = color.new(green, 80))
mid = plot(0, color = color.gray)

//fill(mid, z, zscore, 0, fillcol, color.new(chart.bg_color, 100))

plotchar(ta.crossover(rsi, -30) ? -40 * 1.3 : na, char = "x", color = green, location = location.absolute, size = size.tiny)
plotchar(ta.crossunder(rsi, 30) ? 40 * 1.3 : na, char = "x", color = red, location = location.absolute, size = size.tiny)