Estoy intentando adaptar este código de Lazy Bear, aparecido en la plataforma Tradingview : https://www.tradingview.com/script/HqvTuEMW-Elder-s-Market-Thermometer-LazyBear/
Tengo hecho este esbozo de código , pero no estoy seguro de que esté correcto 100% , ¿alguién me puede echar una mano?
REM ELDER´S MARKET THERMOMETER
// @author LazyBear
// List of all my indicators:
// https://docs.google.com/document/d/15AGCufJZ8CIUvwFJ9W-IKns88gkWOKBCvByMEvm5MLo/edit?usp=sharing
//study("Elder Market Thermometer [LazyBear]", shorttitle="EMT_LB")
lengthMA=22//input(22, "EMA Length")
explosiveMktThreshold=3//input(3, title="Explosive Market Threshold")
idleMarketThreshold=7//input(7, title="Idle Market Threshold")
if emt then
emt=high<high[1] and low>low[1]
else
emt = 0
endif
if emt then
emt = (high - high[1]) > (low[1] - low)
elsif abs(high - high[1]) then
emt=abs(high - high[1])
else
emt= abs(low[1] - low)
endif
aemt =ExponentialAverage[lengthMA](emt)
if aemt>emt then
qc=(qc[1])+1
else
qc=0
endif
if (emt > aemt) and (emt < aemt*explosiveMktThreshold)then
r=255
g=165
b=0
else
r=255
g=0
b=0
endif
if (emt < aemt) then
if qc>idleMarketThreshold then
r=0
g=128
b=0
else
r=0
g=0
b=255
endif
endif
return emt coloured(r,g,b)style(histogram)as "Market Thermometer",aemt coloured(255,0,255)as"EMA of Market Thermometer"
No creo que sea correcto para la primera parte, no ha traducido correctamente el IFF. Piense en ello como un bloque de condición completo hecho de IF .. THEN .. ELSE
Debería ser una excelente adición a la biblioteca una vez que haya terminado, hágame saber si necesita más ayuda.
Pués si Nicolas , no doy con ello…
REM ELDER´S MARKET THERMOMETER
// @author LazyBear
// List of all my indicators:
// https://docs.google.com/document/d/15AGCufJZ8CIUvwFJ9W-IKns88gkWOKBCvByMEvm5MLo/edit?usp=sharing
//study("Elder Market Thermometer [LazyBear]", shorttitle="EMT_LB")
lengthMA=22//input(22, "EMA Length")
explosiveMktThreshold=3//input(3, title="Explosive Market Threshold")
idleMarketThreshold=7//input(7, title="Idle Market Threshold")
if high<high[1] and low>low[1] then
emt=0
elsif (high-high[1])> low[1]-low then
emt=abs(high-high[1])
else
emt = abs(low[1] - low)
endif
aemt =ExponentialAverage[lengthMA](emt)
if aemt>emt then
qc=(qc[1])+1
else
qc=0
endif
if (emt > aemt) and (emt < aemt*explosiveMktThreshold)then
r=255
g=165
b=0
else
r=255
g=0
b=0
endif
if (emt < aemt) then
if qc>idleMarketThreshold then
r=0
g=128
b=0
else
r=0
g=0
b=255
endif
endif
return emt coloured(r,g,b)style(histogram)as "Market Thermometer",aemt coloured(255,0,255)as"EMA of Market Thermometer"
Hola, un concepto interesante. Creo que el codigo correcto seria este.
Saludos
Si no es el correcto , se le parece… muchas gracias por traducir la primera parte del código correctamente.siguiendo las líneas de código, he hecho esta pequeña variación para seguir el orden…
REM ELDER´S MARKET THERMOMETER
// @author LazyBear
// List of all my indicators:
// https://docs.google.com/document/d/15AGCufJZ8CIUvwFJ9W-IKns88gkWOKBCvByMEvm5MLo/edit?usp=sharing
//study("Elder Market Thermometer [LazyBear]", shorttitle="EMT_LB")
lengthMA=22//input(22, "EMA Length")
explosiveMktThreshold=3//input(3, title="Explosive Market Threshold")
idleMarketThreshold=7//input(7, title="Idle Market Threshold")
if high<high[1] and low>low[1] then
emt=0
elsif (high-high[1])> low[1]-low then
emt=abs(high-high[1])
else
emt = abs(low[1] - low)
endif
aemt =ExponentialAverage[lengthMA](emt)
if aemt>emt then
qc=(qc[1])+1
else
qc=0
endif
if (emt< aemt) then
if qc>idleMarketThreshold then
r=0
g=128
b=0
else
r=0
g=0
b=255
endif
elsif (emt > aemt) and (emt < aemt*explosiveMktThreshold)then
r=255
g=165
b=0
else
r=255
g=0
b=0
endif
return emt coloured(r,g,b)style(histogram)as "Market Thermometer",aemt coloured(255,0,255)as"EMA of Market Thermometer"
Después de una repetición rápida, creo que esta vez corresponde al código pinescript! Felicidades 🙂
¿Por qué no transferirlo a la biblioteca ahora? Te dejo hacerlo;)
Siempre con el permiso de villares, a él lecorresponde la traducción correcta del primer bloque del código.
Hola, la idea de adaptar este indicador y casi todo el codigo lo has aportado tu, asi que no necesitas mi permiso 🙂
Saludos cordiales y gracias x tus aportaciones
Buenas noches Nicolas. ¿ Podrás subir tú el código de este indicador a la biblioteca?,no sé porque razón no me deja hacerlo
Sí, lo haré con tu propio nombre, lo antes posible. Muchas gracias por esta nueva adición.