Overblog Suivre ce blog
Editer l'article Administration Créer mon blog
11 février 2008 1 11 /02 /février /2008 20:54

Astuce : comment colorier le graphique suivant un indicateur ?

 

Une des lacunes du logiciel Prorealtime est de ne pas pouvoir colorer les barres ou chandeliers en fonction d'un indicateur et non simplement en fonction du critère hausse/baisse du cours.

 

Voici un code, assez fastidieux à paramètrer, mais le résultat à l'écran est bluffant !

 

Exemple en version "candle", pour le Nasdaq Comp, avec la coloration suivant le sens de M7 :

 

hk35.gif

 

Et maintenant en version "barchart" :

 

hk36.gif

 

Il faut d'abord créer une fenètre avec le prix (barchart), puis ajouter l'indicateur sur le prix et paramètrer le tout : gros points et couleur des points.  Il faut également mettre la condition c1 à votre sauce et changer le return  pour "ave" (que j'ai mis uniquement pour contrôle).

 

Version "candle" :

 

ave=average[7](close)
c1=(ave>ave[1])
if c1 then
    c=1
else
    c=-1
endif
r=abs(open-close)
r=(r)/29
if open<close then
    b1=open
else
    b1=close
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,ave

 

En version "barchart" :

 

ave=average[7](close)
c1=(ave>ave[1])
if c1 then
    c=1
else
    c=-1
endif
r=(high-low)/29
b1=low
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,ave

Partager cet article

Repost 0
Published by hk_lisse - dans Prorealtime Astuces
commenter cet article

commentaires