Bonjour,
Rien de secret ici, je suis simplement entrain de décortiquer le code ZIGZAG de Nicolas pour compréhension, voici le code à exécuter en UT 5, il faut évidement dézoomer pour lire les valeurs.
Dézoomer ne me pose pas de problème même si ce n’est pas pratique, ce qui me gêne le plus c’est de ne pas pouvoir lire le contenu des variables par moment.
percent = 0.011
//if Dynamic then
//var = cumsum(range)/barindex
//varP = var/close*100
//percent = average[100](varP)
//else
//percent = PercentVariation
//endif
//Pic = Peak
if lastpoint<=0 then
drawtext("HIGHER avant#higher#",barindex,high+2,SansSerif,Standard,14) coloured(255,0,0)
//DrawText("#c#",barindex-65,0.75,SansSerif,Standard,17)
higher = max(higher,close)
drawtext("HIGHER après#higher#",barindex,high+4,SansSerif,Standard,14) coloured(255,0,0)
//drawtext("Higher #higher#",barindex,high+1) coloured(255,0,0)
if higher <>higher[1] then
highbar = barindex
endif
endif
peakpercent =((higher-close)/higher)
drawtext("pourcent#peakpercent#",barindex,high+5,SansSerif,Standard,13)coloured ("white")
drawtext("percent#percent#",barindex,high+6,SansSerif,Standard,13)coloured ("white")
newpeak = peakpercent >= percent/100
if newpeak then
drawtext("■",highbar,higher+1) coloured(255,0,0)
higher=0
lastpoint=1
endif
// Creux = Trough
once lower = close // parce que sinon il démarrera jamais car lower = 0 au démarrage
if lastpoint>=0 then
lower=min(lower,close)
if lower <> lower[1] then
lowbar = barindex
endif
troughpercent = (close-lower) / lower
newtrough = troughpercent >= percent/100
if newtrough then
drawtext("■",lowbar,lower-1) coloured("cyan")
lower=close*100 // pour etre sur de réinitialiser la variable
lastpoint=-1
endif
endif
Return