TradingView
InversionesenelMundo1
22. Aug. 2019 18:20

Koncorde Inversiones en el Mundo 

CMS Energy CorporationNYSE

Beschreibung

Oscillador de Volumen
Kommentare
lico11sfc
genial
calpu
Hola,

Al copiar el script tengo:

Processing script...
line 8: Undeclared identifier 'pvi';
line 9: Undeclared identifier 'pvi';
line 9: Variable 'pvi' is not found in scope 'anonym_function_0', cannot register side effect;
line 13: Undeclared identifier 'nvi';
line 14: Undeclared identifier 'nvi';
line 14: Variable 'nvi' is not found in scope 'anonym_function_1', cannot register side effect;
line 26: Undeclared identifier 'pvi';
line 27: Undeclared identifier 'pvim';
line 28: Undeclared identifier 'pvim';
line 29: Undeclared identifier 'pvi';
line 29: Undeclared identifier 'pvim';
line 29: Undeclared identifier 'pvimax';
line 29: Undeclared identifier 'pvimin';
line 31: Undeclared identifier 'nvi';
line 32: Undeclared identifier 'nvim';
line 33: Undeclared identifier 'nvim';
line 34: Undeclared identifier 'nvi';
line 34: Undeclared identifier 'nvim';
line 34: Undeclared identifier 'nvimax';
line 34: Undeclared identifier 'nvimin';
line 53: Undeclared identifier 'oscp';
line 57: Undeclared identifier 'area';
line 58: Undeclared identifier 'area';
line 59: Undeclared identifier 'azul';
line 59: Undeclared identifier 'area';
line 60: Undeclared identifier 'line';
line 61: Undeclared identifier 'line';
line 62: Undeclared identifier 'azul';
line 62: Undeclared identifier 'line';
line 63: Undeclared identifier 'red';
line 63: Undeclared identifier 'line';
line 64: Undeclared identifier 'black'

Qué puede estar fallando?
Saludos!
thai_peter
@calpu, falta la version yo probaría poder //@version=4 o //@version=2 al principio del script
luciano007
@thai_peter, con version 4 le va a dar error, con @version=2 debería funcionar.
Igual yo estoy viendo de pasarlo a v4 pero no me dibuja el volumen azul y verde, y me sale el siguiente error (que justamente es el volumen de ballenas y peces)

Shadowing built-in variable 'pvi'
Shadowing built-in variable 'nvi'

Ojalá alguien la tenga clara y pueda dar una mano
thai_peter
@luciano007, Recien veo el mensaje. pvi es una funcion interna por lo cual no entiendo el error, yo he copiado y pegado el codigo y me funciona sin ningun agregado. Yo uso la version de escritorio en windows en español por si te ayuda.
calpu
@thai_peter, perdón, recién veo tu mensaje -- gracias por responder, saludos!
vennegor2021
@calpu, buenas, si eliminan la linea 6 y 11 les levanta. Es porque hace la declaracion de las variables 2 veces, primero en la linea 5 y 10 y luego nuevamente en la 6 y 11 pero vacias. corrigiendo eso queda de 10!
Abzo
lkdml
@vennegor2021, tal cual pasa eso y además al pasar a la Version=4, ya hay funciones PVI, NVI y MFI. Por otra parte hay algunas cosas más desde la linea 54 en adelante con las constantes definidas para los estilos y colores.

Si me deja, ahora pego una adaptación que hice en la cual le quito las funciones y le agrego algunos inputs para poder tunearlo un poco.

PD: Gracias Inversiones en el Mundo.

//@version=4
study(title="Koncorde Inversiones en el Mundo by lkdml")
srcTprice = input(ohlc4, title="Fuente para Precio Total")
srcMfi = input(hlc3, title="Fuente MFI", group="Money Flow Index")
tprice=srcTprice

//lengthEMA = input(255, minval=1)
m=input(15, title="Media Exponencial")
longitudPVI=input(90, title="Longitud PVI")
longitudNVI=input(90, title="Longitud NVI")
longitudMFI=input(14, title="Longitud MFI")

pvim = ema(pvi, m)
pvimax = highest(pvim, longitudPVI)
pvimin = lowest(pvim, longitudPVI)
oscp = (pvi - pvim) * 100/ (pvimax - pvimin)

nvim = ema(nvi, m)
nvimax = highest(nvim, longitudNVI)
nvimin = lowest(nvim, longitudNVI)
azul = (nvi - nvim) * 100/ (nvimax - nvimin)

xmf = mfi(srcMfi, longitudMFI)

mult=input(2.0, title="Multiplicador para derivacion estandar" , group="Bollinger Oscillator")
boLength=input(25, title="Calculation length ", group="Bollinger Oscillator" )
// Bands Calculation
basis = sma(tprice, boLength) //Find the 20-day moving average average (n1 + n2 ... + n20)/20
dev = mult * stdev(tprice, boLength) //Find the standard deviation of the 20-days
upper = basis + dev //Upper Band = 20-day Moving Average + (2 x standard deviation of the 20-days)
lower = basis - dev //Lower Band = 20-day Moving Average - (2 x standard deviation of the 20-days)
OB1 = (upper + lower) / 2.0
OB2 = upper - lower

BollOsc = ((tprice - OB1) / OB2 ) * 100 // percent b
xrsi = rsi(tprice, 14)

calc_stoch(src, length,smoothFastD ) =>
ll = lowest(low, length)
hh = highest(high, length)
k = 100 * (src - ll) / (hh - ll)
sma(k, smoothFastD)

stoc = calc_stoch(tprice, 21, 3)
marron = (xrsi + xmf + BollOsc + (stoc / 3))/2
verde = marron + oscp
media = ema(marron,m)
bandacero= 0

vl=plot(verde, color=#66FF66, style=plot.style_area, title="verde")// COLOURED(102,255,102) as “verde” , GREEN
ml=plot(marron, color= #FFCC99, style=plot.style_area, title="marron", transp=0) // COLOURED(255,204,153) as"marron" , BEIGE
al=plot(azul, color=#00FFFF, style=plot.style_area, title="azul") // COLOURED(0,255,255) as “azul” ,
plot(marron, color= #330000, style=plot.style_line, linewidth=2, title="lmarron") // COLOURED(51,0,0) as “lmarron” ,
plot(verde, color=#006600, style=plot.style_line, linewidth=2, title="lineav") // COLOURED(0,102,0) as “lineav” ,
plot(azul, color=#000066, style=plot.style_line, title="lazul" ) // COLOURED(0,0,102) as “lazul” ,
plot(media, color=color.red, title="media", style=plot.style_line, linewidth=2) // COLOURED(255,0,0) as “media” ,
plot(bandacero, color=color.black, title="cero") // COLOURED(0,0,0) as "cero"
Kammel
@lkdml,

hola, a mi no me compila, me da este error :

line 39: Mismatched input 'll' expecting 'end of line without line continuation'.
BochiPlus11
Hola, hay que dejar un espacio (Un TAB en realidad) adelante de las lineas donde esta ll,hh,k y sma.....para que compile..si es delicalito el compilador
Mehr