Le zigzag "rock", version 2.
Voici en quelques sortes la version "remasterisée" de l'indicateur zigzag "rock 'n' roll". Ici, le programme trace tout seul le zigzag. On peut donc mettre l'indicateur directement sur les prix. Attention, pour la construction, j'avais besoin des barres du futur et donc l'indicateur ne fonctionne pas en temps réel.......Il faut que le graphe soit figé avec des données EOD.
Les principes sont les mêmes que dans la première version, à savoir :
-high>high[1] et low>=low[1]...........hausse.
-high>=high[1] et low>low[1]...........hausse.
-low<low[1] et high<=high[1]...........baisse.
-low<=low[1] et high<high[1]...........baisse.
-pour les outsidebar's, je reprends la tendance précédente.
-pour les insidebar's, j'inverse la tendance sauf si l'extrême (dans le sens de la tendance) de la barre suivante est supérieur à l'extrême de la barre précédente (j'ai un peu changé par rapport à la version 1), on reste alors dans la tendance.
Une vue du CAC avec l'indicateur sur prix :
Normalement le programme semble OK mais si vous avez des remarques, il existe une file commentaires.
Le code pour Prorealtime :
d48=DPO[48](close)
if d48=d48[1] and d48[1]=d48[2] and d48[2]<>d48[3] then
fin=barindex+23
endif
once b=1
j=j+1
k=50
n=(k*2)-4
p=(n/2)-1
h1=DPO[n](high)
moyh=high-h1
hi=(moyh-moyh[1]+(high[p])/n)*n
hi=(round(hi*100))/100
l1=dpo[n](low)
moyl=low-l1
lo=(moyl-moyl[1]+(low[p])/n)*n
lo=(round(lo*100))/100
if barindex>100 then
for i= 1 to 49
if barindex[49-i]=fin-48 then
if b=1 then
a=hi[49-i+1]
else
a=lo[49-i+1]
endif
break
else
if b=1 then
if lo[49-i]<=lo[49-i+1] and hi[49-i]<hi[49-i+1] then
if i=1 then
b=-1
j=0
endif
a=hi[49-i+1]
break
endif
if lo[49-i]<lo[49-i+1] and hi[49-i]<=hi[49-i+1] then
if i=1 then
b=-1
j=0
endif
a=hi[49-i+1]
break
endif
if lo[49-i]>lo[49-i+1] and hi[49-i]<hi[49-i+1] then
if hi[49-i-1]<=hi[49-i+1] then
if i=1 then
b=-1
j=0
endif
a=hi[49-i+1]
break
endif
endif
endif
if b=-1 then
if hi[49-i]>hi[49-i+1] and lo[49-i]>=lo[49-i+1] then
if i=1 then
b=1
j=0
endif
a=lo[49-i+1]
break
endif
if hi[49-i]>=hi[49-i+1] and lo[49-i]>lo[49-i+1] then
if i=1 then
b=1
j=0
endif
a=lo[49-i+1]
break
endif
if lo[49-i]>lo[49-i+1] and hi[49-i]<hi[49-i+1] then
if lo[49-i-1]>=lo[49-i+1] then
if i=1 then
b=1
j=0
endif
a=lo[49-i+1]
break
endif
endif
endif
endif
next
else
a=high
endif
if j=0 then
rep=a
endif
if a[1]=rep[1] then
coef=i
endif
zig=rep+(a-rep)*j/coef
return zig
Edit le 10/11 : je prévois déjà une version 3, il faudra changer la logique sur certaines outsidebar's comme pour fin octobre sur le CAC.