Overblog Suivre ce blog
Editer l'article Administration Créer mon blog
26 avril 2008 6 26 /04 /avril /2008 19:33


Value Charts : le code pour Prorealtime.

Suite à une demande, voici le code de l'indicateur Value Charts de David Stendhal pour la plateforme Prorealtime.  Comme pour la représentation Heikin Ashi, je dois afficher des bougies et ainsi créer 3 indicateurs : mèche basse, mèche haute et corps de la bougie.  Enfin, un dernier indicateur signalant les zones est codé.  Pour avoir la représentation complète à l'écran il faut donc dans l'ordre suivant afficher l'indicateur "valuecharts bas", y ajouter le "valuecharts haut" puis le "valuecharts corps" et enfin le "valuecharts lignes".  Il faut encore paramètrer le tout en points, grosse épaisseur pour le corps, fine pour les mèches.  J'ai trouvé 2 versions de l'indicateur : une avec l'ATR (dont le code se retrouve ci-dessous) et une avec simplement le range.  On peut aussi imaginer faire varier le paramètre (ici fixé à 5).

Voici les différents codes :

/////////////////// valuecharts bas ////////////////
ma=average[5](medianprice)
vu=(average[5](AverageTrueRange[1](close)))*.2
vc=(close-ma)/vu
vo=(open-ma)/vu
vl=(low-ma)/vu
c2=min(vo,vc)
r=abs(c2-vl)
r=(r)/29
b1=vl
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

////////////// valuecharts haut /////////////////
ma=average[5](medianprice)
vu=(average[5](AverageTrueRange[1](close)))*.2
vc=(close-ma)/vu
vo=(open-ma)/vu
vh=(high-ma)/vu
c2=max(vo,vc)
r=abs(vh-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

////////////////// valuecharts corps ////////////////////
ma=average[5](medianprice)
vu=(average[5](AverageTrueRange[1](close)))*.2
vc=(close-ma)/vu
vo=(open-ma)/vu
r=abs(vo-vc)
r=(r)/29
if vo<vc then
    b1=vo
else
    b1=vc
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
c=vc-vo
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

////////////// valuecharts lignes /////////////
return 4,-4,8,-8

Partager cet article

Repost 0
Published by hk_lisse - dans Indicateurs
commenter cet article

commentaires