Overblog Suivre ce blog
Editer l'article Administration Créer mon blog
21 février 2008 4 21 /02 /février /2008 19:00

La  représentation en Heikin Ashi : les codes du programme Prorealtime.

Suite à la demande  de Camille, voici les codes Prorealtime.  Tout d'abord, je crée 3 indicateurs qui renvoient les cours en Heikin Ashi : 1. la méthode originale, 2. le lissage avec la T3 de Tillson (de période 3) et 3. le lissage avec la moyenne Kaufman adaptative (KAMA de période 2).


//////////////// indicateur heikin simple //////////////
once haopen=open
haclose=(open+close+high+low)/4
if barindex> 0 then
    haopen=(haopen+haclose[1])/2
endif
halow=min(low,min(haclose,haopen))
hahigh=max(high,max(haclose,haopen))
return haopen,haclose,hahigh,halow


//////////////// indicateur heikin tillson /////////////////
period=3
price=close
vfactor=.7
x1=(exponentialaverage[period](price))*(1+vfactor)
x2=(exponentialaverage[period](exponentialaverage[period](price)))*vfactor
gd=x1-x2
x11=(exponentialaverage[period](gd))*(1+vfactor)
x21=(exponentialaverage[period](exponentialaverage[period](gd)))*vfactor
gd1=x11-x21
x12=(exponentialaverage[period](gd1))*(1+vfactor)
x22=(exponentialaverage[period](exponentialaverage[period](gd1)))*vfactor
gd2=x12-x22

once haopen=open
haclose=gd2
if barindex> 12 then
    haopen=(haopen+haclose[1])/2
endif
halow=min(low,min(haopen,haclose))
hahigh=max(high,max(haopen,haclose))
return haopen,haclose,hahigh,halow

///////////////////// indicateur heikin kama /////////////////
p=2
ONCE ama = UNDEFINED
signal = ABS(MOMENTUM[p])
noise = SUMMATION[p](ABS(MOMENTUM[1]))
IF noise>0 THEN
    er = signal / noise
ELSE
    er=1
ENDIF
fastsc = 2 / (2+ 1)
slowsc = 2 / (20 + 1)
factor = SQUARE(er * (fastsc - slowsc) + slowsc)
IF BARINDEX = p THEN
    ama = CLOSE
ELSIF BARINDEX > p THEN
    ama = ama + factor * (CLOSE - ama)
ENDIF

once haopen=open
haclose=ama
if barindex> 12 then
    haopen=(haopen+haclose[1])/2
endif
halow=min(low,min(haopen,haclose))
hahigh=max(high,max(haopen,haclose))
return haopen,haclose,hahigh,halow

Puis de nouveau, je crée 3 indicateurs pour dessiner les bougies en Heikin Ashi : 1. la mèche basse, 2. la mèche haute et 3. le corps de la bougie. 

////////////////// indicateur mèche basse heikin /////////////
haopen,haclose,ignored,bas = CALL "heikin tillson"
c2=min(haopen,haclose)
r=abs(c2-bas)
r=(r)/29
b1=bas
c=1
b2=b1+r
b3=b2+r
b4=b3+r
b5=b4+r
b6=b5+r
b7=b6+r
b8=b7+r
b9=b8+r
b10=b9+r
b11=b10+r
b12=b11+r
b13=b12+r
b14=b13+r
b15=b14+r
b16=b15+r
b17=b16+r
b18=b17+r
b19=b18+r
b20=b19+r
b21=b20+r
b22=b21+r
b23=b22+r
b24=b23+r
b25=b24+r
b26=b25+r
b27=b26+r
b28=b27+r
b29=b28+r
b30=b29+r

return b1 coloured by c,b2 coloured by c,b3 coloured by c,b4 coloured by c,b5 coloured by c,b6 coloured by c,b7 coloured by c,b8 coloured by c,b9 coloured by c,b10 coloured by c,b11 coloured by c,b12 coloured by c,b13 coloured by c,b14 coloured by c,b15 coloured by c,b16 coloured by c,b17 coloured by c,b18 coloured by c,b19 coloured by c,b20 coloured by c,b21 coloured by c,b22 coloured by c,b23 coloured by c,b24 coloured by c,b25 coloured by c,b26 coloured by c,b27 coloured by c,b28 coloured by c,b29 coloured by c,b30 coloured by c

///////////////////////// indicateur mèche haute heikin /////////////////////
haopen,haclose,haut,ignored = CALL "heikin tillson"
c2=max(haopen,haclose)
r=abs(haut-c2)
r=(r)/29
b1=c2
c=1
b2=b1+r
b3=b2+r
b4=b3+r
b5=b4+r
b6=b5+r
b7=b6+r
b8=b7+r
b9=b8+r
b10=b9+r
b11=b10+r
b12=b11+r
b13=b12+r
b14=b13+r
b15=b14+r
b16=b15+r
b17=b16+r
b18=b17+r
b19=b18+r
b20=b19+r
b21=b20+r
b22=b21+r
b23=b22+r
b24=b23+r
b25=b24+r
b26=b25+r
b27=b26+r
b28=b27+r
b29=b28+r
b30=b29+r

return b1 coloured by c,b2 coloured by c,b3 coloured by c,b4 coloured by c,b5 coloured by c,b6 coloured by c,b7 coloured by c,b8 coloured by c,b9 coloured by c,b10 coloured by c,b11 coloured by c,b12 coloured by c,b13 coloured by c,b14 coloured by c,b15 coloured by c,b16 coloured by c,b17 coloured by c,b18 coloured by c,b19 coloured by c,b20 coloured by c,b21 coloured by c,b22 coloured by c,b23 coloured by c,b24 coloured by c,b25 coloured by c,b26 coloured by c,b27 coloured by c,b28 coloured by c,b29 coloured by c,b30 coloured by c

//////////////////// indicateur corps heikin ///////////////
haopen,haclose,ignored,ignored = CALL "heikin tillson"
c1=(haopen<haclose)
if c1 then
    c=1
else
    c=-1
endif
r=abs(haopen-haclose)
r=(r)/29
if haopen<haclose then
    b1=haopen
else
    b1=haclose
endif
b2=b1+r
b3=b2+r
b4=b3+r
b5=b4+r
b6=b5+r
b7=b6+r
b8=b7+r
b9=b8+r
b10=b9+r
b11=b10+r
b12=b11+r
b13=b12+r
b14=b13+r
b15=b14+r
b16=b15+r
b17=b16+r
b18=b17+r
b19=b18+r
b20=b19+r
b21=b20+r
b22=b21+r
b23=b22+r
b24=b23+r
b25=b24+r
b26=b25+r
b27=b26+r
b28=b27+r
b29=b28+r
b30=b29+r

return b1 coloured by c,b2 coloured by c,b3 coloured by c,b4 coloured by c,b5 coloured by c,b6 coloured by c,b7 coloured by c,b8 coloured by c,b9 coloured by c,b10 coloured by c,b11 coloured by c,b12 coloured by c,b13 coloured by c,b14 coloured by c,b15 coloured by c,b16 coloured by c,b17 coloured by c,b18 coloured by c,b19 coloured by c,b20 coloured by c,b21 coloured by c,b22 coloured by c,b23 coloured by c,b24 coloured by c,b25 coloured by c,b26 coloured by c,b27 coloured by c,b28 coloured by c,b29 coloured by c,b30 coloured by c


J'ouvre une fenêtre avec l'indicateur de mèche basse, j'y ajoute l'indicateur de mèche haute puis l'indicateur de corps (tout cela dans la même fenêtre).  Tous les indicateurs sont à mettre en points, épaisseur 2 pour les mèches et maximum pour le corps.  Couleur noire pour les mèches et vert/rouge pour le corps.  c'est assez fastidieux à faire mais une fois paramètré, le résultat à l'écran est exellent.

Sur la deuxième ligne du programme, on peut appeler "heikin simple" ou "heikin kama" à la place de "heikin tillson".

Voici un lien (page 14) où est expliqué un système basé sur le Heikin Ashi modifié, en plus d'utiliser une moyenne pour lisser les cours, le cours est modifié par la formule : cclose=((open+close)/2+(((close-open)/(high-low))*abs(close-open)/2)). 

Les informations sont tirées du forum Aktienboard dédié à la programmation Prorealtime (c'est  ici)..  fck

Partager cet article

Repost 0
Published by hk_lisse - dans Heikin Ashi
commenter cet article

commentaires