Im trying to create an RSI oscillator that will have a secondary indicator laid over it. So its a combination of two indicators.
The RSI commonly uses the (50) level as its midline. The other Oscillator i am using, uses the (0) level as its midline. With that, i have been able to move the RSI to the (0) level to use as its midline and match the other indicator. However, I think i need to use some type of multiplier function that I'm not familiar with?
Now that i have been able to center the RSI to the other indicators' MIDLINE (ZERO level), it shows readings in the STATUS line but you cant see the oscillator because the movement is too small. I noticed that prior to moving the RSI To the ZERO line, it would give a reading of 2 digit whole number with a 2 digit decimal. Now it gives a 4 digit decimal so the movement is being calculated to a number so small, it wont show up visually.
So i think i need some kind of multiplier function typed in? Im not sure.
Let me know if the attached image helps at all.Tradingview Screenshot showing small value indicators
//Lets Make an RSI with an Moving average attached
//
ma(source, length, type) =>
switch type
"SMA" => ta.sma(source, length)
"Bollinger Bands" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings")
rsiSourceInput = input.source(close, "Source", group="RSI Settings")
maTypeInput = input.string("SMA", title="MA Type", options=["SMA", "Bollinger Bands", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="MA Settings")
maLengthInput = input.int(14, title="MA Length", group="MA Settings")
bbMultInput = input.float(2.0, minval=0.001, maxval=50, title="BB StdDev", group="MA Settings")
up = ta.rma(math.max(ta.change(rsiSourceInput), -50), rsiLengthInput)
down = ta.rma(-math.min(ta.change(rsiSourceInput), -50), rsiLengthInput)
rsi = down == 0 ? 100 : up == 0 ? 50 : 100 - (100 / (1 + up / down))
rsiMA = ma(rsi, maLengthInput, maTypeInput)
isBB = maTypeInput == "Bollinger Bands"
plot(rsi, "RSI", color=#7E57C2)
plot(rsiMA, "RSI-based MA", color=color.yellow)
rsiUpperBand = hline(30, "RSI Upper Band", color=#787B86)
hline(0, "RSI Middle Band", color=color.new(#787B86, 50))
rsiLowerBand = hline(-30, "RSI Lower Band", color=#787B86)
fill(rsiUpperBand, rsiLowerBand, color=color.rgb(126, 87, 194, 90), title="RSI Background Fill")
bbUpperBand = plot(isBB ? rsiMA + ta.stdev(rsi, maLengthInput) * bbMultInput : na, title = "Upper Bollinger Band", color=color.green)
bbLowerBand = plot(isBB ? rsiMA - ta.stdev(rsi, maLengthInput) * bbMultInput : na, title = "Lower Bollinger Band", color=color.green)
fill(bbUpperBand, bbLowerBand, color= isBB ? color.new(color.green, 90) : na, title="Bollinger Bands Background Fill")
Subtract 50 from both 'rsi' & 'rsiMA' while plotting. This will change the default RSI range from [100-0] to [50-(-50)]