Rank: Advanced Member
Groups: Moderators, Registered, Registered Users, Subscribers Joined: 10/8/2010(UTC) Posts: 1,960
Thanks: 92 times Was thanked: 155 time(s) in 150 post(s)
|
Sylvain Vervoort's article, “The V-Trade, part 3”, introduced a modified pivot point indicator, “SvePivots”. The MetaStock formula for that indicator is below:
SvePivotsCode:new:=ROC(DayOfWeek(),1,$)<>0;
YH:=ValueWhen(1,new, Ref(HighestSince(1,new,H),-1));
YL:=ValueWhen(1,new, Ref(LowestSince(1,new,L),-1));
YC:=ValueWhen(1,new, Ref(C,-1));
pp:=(YC+YH+YL)/3;
r1:=(pp*2)-YL;
s1:=(pp*2)-YH;
r2:= pp+(YH-YL);
s2:= pp-(YH-YL);
r3:= (pp*2)+(YH-(YL*2));
s3:= (pp*2)-((YH*2)-YL);
rm1:= ((r1-pp)/2)+pp;
sm1:= ((pp-s1)/2)+s1;
rm2:= ((r2-r1)/2)+r1;
sm2:= ((s1-s2)/2)+s2;
rm3:= ((r3-r2)/2)+r2;
sm3:= ((s2-s3)/2)+s3;
YH; {previous day's high}
YL; {previous day's low}
r3;
rm3;
r2;
rm2;
r1;
rm1;
pp;
sm1;
s1;
sm2;
s2;
sm3;
s3;
This indicator plots fifteen lines. Thirteen of those at in numerical order from highest to lowest. The R3 line is always the top and the S3 line is always the bottom of these thirteen lines. However, the lines for the previous day’s high and low will shift where they are admist the other lines. This behavior is normal but causes difficulty in coloring the lines.
MetaStock’s formula language does not allow colors to be assigned as part of the formula. Instead, the colors and line styles are set after the indicator is plotted in the chart. To facilitate coloring the previous day’s hight and low prices, these two lines are the first ones plotted. That means, if you look at the Data Window, or the tool tip for this indicator, those values will be listed first. That allows you to find them more easily in the list of the lines and then assign the desired colors. The remaining lines can then be colored by counting from either the top or bottom of the list.
|