Convertir indicador de TradingView
Forums › ProRealTime foro Español › Soporte ProBuilder › Convertir indicador de TradingView
- This topic has 4 replies, 2 voices, and was last updated 4 days ago by
micky_red.
-
-
03/18/2025 at 1:17 PM #245008
Hola, me gustaría solicitar si es posible convertir el indicador de TradingView que adjunto:
Más info del indicador en: Índice de volatilidad relativa — TradingView
Adjunto una imagen de su ventana de parámetros, así como su código fuente.
Muchas gracias por adelantado. ¡Saludos!
Código fuente del indicador en TV1234567891011121314151617181920212223242526272829303132333435363738394041424344//@version=6indicator(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 = closelen = 14stddev = 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) * 100h0 = 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 inputsGRP = "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 Calculationma(source, length, MAtype) =>switch MAtype"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 plotssmoothingMA = enableMA ? ma(rvi, maLengthInput, maTypeInput) : nasmoothingStDev = isBB ? ta.stdev(rvi, maLengthInput) * bbMultInput : naplot(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)03/19/2025 at 1:01 PM #245049Hola. Este indicador ya fue traducido hace unos meses.
https://www.prorealcode.com/topic/conversione-di-codice-pine/
03/19/2025 at 10:00 PM #245063Muchas gracias Iván por responder.
Lo he estado probando y el resultado es aproximado pero no exacto.
Te he adjuntado unas capturas de pantalla del indicador cargado y funcionando en el DAX de hoy en PRT así como en TradingView, te he señalado las diferencias para ver si podrías ayudarme a ajustarlo para que el resultado sea el mismo.
Muchas gracias por adelantado!
03/20/2025 at 10:34 AM #24508803/20/2025 at 11:57 AM #245089Hola Iván, si lo he tenido en cuenta y entiendo que puede haber alguna variación.
A pesar de ello, si comparamos los RSI se ven exactamente iguales, mientras en el RVI hay variaciones notables, por eso pienso que quizás exista algún parámetro que pueda ajustarse para que el resultado sea lo más parecido posible.
En fin, si pudieras revisarlo te lo agradecería muchísimo.
Saludos.
-
AuthorPosts
Find exclusive trading pro-tools on