[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Metastockusers] equivalent zig zag formula



PureBytes Links

Trading Reference Links

Hello

  I was wondering if anyone would know how to write a formula to do what the
zig zag indicator does.  I wanted to write the equivalent formula using the
basic MetaStock formulas.  In order for the zig zag to draw a linear line
you need to know point A to point B.  I created a simple formula to do this.
First I needed to know the slope of point A to point B.  In my sample
formula point A is the first day of data loaded and point B is the last day
of data loaded.  Slope = rise over run.  Rise is the difference between
point A and point B.  The run is the number of days over the data.  Once you
have the slope you just add this each day to the previous day of the data.
The result is a nice linear line going from point A to point B.  The problem
I need to figure out is how to get point A and point B to change according
to a certain percentage like in the zig zag formula.

Sample formula for drawing a linear line from first to last day of data.

slope:=(LastValue(C)-ValueWhen(1,Cum(1)=1,C))/LastValue(Cum(1));

line:=ValueWhen(1,Cum(1)=1,C)+Cum(slope);

line;

You might ask why write a formula to do what the basic zig(data array, min
change,diff method) all ready does.  I guess it is just curiosity.  I figure
it could help in writing other formulas.

Thanks

Steve



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/O10svD/Me7FAA/AG3JAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/