Buondì, qualcuno è in grado di convertire il codice PINE di questo indicatore? mi sembra interessante
//@version=6
indicator(title=”Relative Volatility Index”, shorttitle=”RVI”, format=format.price, precision=2, timeframe=””, timeframe_gaps=true)
length = input.int(10, minval=1)
offset = input.int(0, “Offset”, minval = -500, maxval = 500)
src = close
len = 14
stddev = ta.stdev(src, length)
upper = ta.ema(ta.change(src) <= 0 ? 0 : stddev, len)
lower = ta.ema(ta.change(src) > 0 ? 0 : stddev, len)
rvi = upper / (upper + lower) * 100
h0 = hline(80, “Upper Band”, color=#787B86)
hline(50, “Middle Band”, color=color.new(#787B86, 50))
h1 = hline(20, “Lower Band”, color=#787B86)
fill(h0, h1, color=color.rgb(126, 87, 194, 90), title=”Background”)
plot(rvi, title=”RVI”, color=#7E57C2, offset = offset)
// Smoothing MA inputs
GRP = “Smoothing”
TT_BB = “Only applies when ‘SMA + Bollinger Bands’ is selected. Determines the distance between the SMA and the bands.”
maTypeInput = input.string(“SMA”, “Type”, options = [“None”, “SMA”, “SMA + Bollinger Bands”, “EMA”, “SMMA (RMA)”, “WMA”, “VWMA”], group = GRP, display = display.data_window)
maLengthInput = input.int(14, “Length”, group = GRP, display = display.data_window)
bbMultInput = input.float(2.0, “BB StdDev”, minval = 0.001, maxval = 50, step = 0.5, tooltip = TT_BB, group = GRP, display = display.data_window)
var enableMA = maTypeInput != “None”
var isBB = maTypeInput == “SMA + Bollinger Bands”
// Smoothing MA Calculation
ma(source, length, MAtype) =>
switchMAtype
“SMA”=>ta.sma(source,length)
“SMA + 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)
// Smoothing MA plots
smoothingMA = enableMA ? ma(rvi, maLengthInput, maTypeInput) : na
smoothingStDev = isBB ? ta.stdev(rvi, maLengthInput) * bbMultInput : na
plot(smoothingMA, “RVI-based MA”, color=color.yellow, display = enableMA ? display.all : display.none, editable = enableMA)
bbUpperBand = plot(smoothingMA + smoothingStDev, title = “Upper Bollinger Band”, color=color.green, display = isBB ? display.all : display.none, editable = isBB)
bbLowerBand = plot(smoothingMA – smoothingStDev, title = “Lower Bollinger Band”, color=color.green, display = isBB ? display.all : display.none, editable = isBB)
fill(bbUpperBand, bbLowerBand, color= isBB ? color.new(color.green, 90) : na, title=”Bollinger Bands Background Fill”, display = isBB ? display.all : display.none, editable = isBB)