Inserto el código completo, que creo que se lee mejor.
Se trata de un indicador para la comunidad de Domenec Suria. A ver si Iván González nos puede echar una mano 😉
/*
Genial Line de Domenec Suria para espacio de trabajo en 144s
Requirements:
-Usar SÓLO en 144s
-Usar 50k de historia para obtener buena precisión
ChangeLog:
...
20250205: añadida la ZC en 144s.
*/
DEFPARAM DRAWONLASTBARONLY = true
DEBUG = 1
TotalBars = BarIndex[0]
IF DEBUG = 1 THEN
DRAWTEXT("Total bars: #TotalBars#", BarIndex[0], High[0])
ENDIF
VelasBanda=20
pi= 3.14159265358979
timeframe(1 day)//, UPDATEONCLOSE)
once SmoothPrice1d=close
once SmoothRange1d=range
mitjana1d= close
if barindex>1 then
SmoothPrice1d=(SmoothPrice1d[1]*(VelasBanda-1)+Close)/VelasBanda
SmoothRange1d=(SmoothRange1d[1]*(VelasBanda-1)+High-Low)/VelasBanda
Alt11d=(SmoothPrice1d+SmoothRange1d*pi)
Baix11d=(SmoothPrice1d-SmoothRange1d*pi)
Mitjana1d= (Alt1d+Baix1d)/2
Alt1d=DEMA(Alt11d)
Baix1d=dema(baix11d)
//Mitjana1d= (Alt1d+Baix1d)/2
endif
GL1d=(mitjana1d+average[34](close))/2
timeframe(4 hours)
once SmoothPrice4h=close
once SmoothRange4h=range
mitjana4h= close
if barindex>1 then
SmoothPrice4h=(SmoothPrice4h[1]*(VelasBanda-1)+Close)/VelasBanda
SmoothRange4h=(SmoothRange4h[1]*(VelasBanda-1)+High-Low)/VelasBanda
Alt14h=(SmoothPrice4h+SmoothRange4h*pi)
Baix14h=(SmoothPrice4h-SmoothRange4h*pi)
Mitjana4h= (Alt4h+Baix4h)/2
Alt4h=DEMA(Alt14h)
Baix4h=dema(baix14h)
endif
GL4h=(mitjana4h+average[34](close))/2
timeframe(60 minutes)
once SmoothPrice1h=close
once SmoothRange1h=range
mitjana1h= close
if barindex>1 then
SmoothPrice1h=(SmoothPrice1h[1]*(VelasBanda-1)+Close)/VelasBanda
SmoothRange1h=(SmoothRange1h[1]*(VelasBanda-1)+High-Low)/VelasBanda
Alt11h=(SmoothPrice1h+SmoothRange1h*pi)
Baix11h=(SmoothPrice1h-SmoothRange1h*pi)
Mitjana1h= (Alt1h+Baix1h)/2
Alt1h=DEMA(Alt11h)
Baix1h=dema(baix11h)
endif
GL1h=(mitjana1h+average[34](close))/2
timeframe(12 minutes)
once SmoothPrice12m=close
once SmoothRange12m=range
mitjana12m= close
if barindex>1 then
SmoothPrice12m=(SmoothPrice12m[1]*(VelasBanda-1)+Close)/VelasBanda
SmoothRange12m=(SmoothRange12m[1]*(VelasBanda-1)+High-Low)/VelasBanda
Alt112m=(SmoothPrice12m+SmoothRange12m*pi)
Baix112m=(SmoothPrice12m-SmoothRange12m*pi)
Mitjana12m= (Alt12m+Baix12m)/2
Alt12m=DEMA(Alt112m)
Baix12m=dema(baix112m)
endif
GL12m=(mitjana12m+average[34](close))/2
timeframe(default, updateonclose)
once SmoothPrice=close
once SmoothRange=range
mitjana= close
if barindex>1 then
SmoothPrice=(SmoothPrice[1]*(VelasBanda-1)+Close)/VelasBanda
SmoothRange=(SmoothRange[1]*(VelasBanda-1)+High-Low)/VelasBanda
Alt1=(SmoothPrice+SmoothRange*pi)
Baix1=(SmoothPrice-SmoothRange*pi)
Mitjana= (Alt+Baix)/2
Alt=DEMA(Alt1)
Baix=dema(baix1)
endif
GL144s =(mitjana+average[34](close))/2
//ZC1: color según la pendiente de la curva
ZC1144s = average[8,1](customclose)
ZC2144s = wilderaverage[8](close)
if ZC1144s <= ZC1144s[1] then
ZC1R = 200 //R RGB + Transparency
ZC1G = 50 //G
ZC1B = 50 //B
ZC1T = 255 //T
endif
if ZC1144s > ZC1144s[1] then
ZC1R = 50 //R RGB + Transparency
ZC1G = 200 //G
ZC1B = 50 //B
ZC1T = 255 //T
endif
//pintamos la línea
return GL1d style(dottedline,4)as "Genial 1d", GL4h style(dottedline,4)as "Genial 4h", GL1h style(dottedline,4)as "Genial 1h", GL12m style(dottedline,4)as "Genial 12m", GL144s style(dottedline,4)as "Genial 144s", ZC1144s style(line,4) coloured(ZC1R, ZC1G, ZC1B, ZC1T) as "Zona de corrección 1", ZC2144s coloured(160,0,0) style(dottedline,2) as "Zona de corrección 2"
//return GL1d coloured(0, 0, 255) style(dottedline,4)as "Genial 1d", GL4h coloured(0, 0, 255) style(dottedline,4)as "Genial 4h", GL1h coloured(0, 0, 255) style(dottedline,4)as "Genial 1h", GL12m coloured(0, 0, 255) style(dottedline,4)as "Genial 12m", GL144s coloured(255, 255,0) style(dottedline,4)as "Genial 144s"