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

Re: McGinley Dynamics



PureBytes Links

Trading Reference Links

On Thu, 05 Dec 2002, Trey Johnson wrote:

>  The code for this indicator in Kaufman's book, "Trading Systems and
> Methods," is the following:
> 
> 	inputs: k(.6),period(9);
> 	vars:MD(0);
> 
> 		MD=MD[1]+(c-MD[1])/K*period*power((c/MD[1]),4);
> 
> 		plot1(MD,"MD");
> 
> However, it doesn't work. I keep getting the error message: "attempt to
> divide by zero." I tried a couple of different things and still can't get it
> to work. Any suggestions?
> Thanks in advance,
> Trey Johnson
> 
> 

The divide by zero is either in the first term or the second.
Put checks to see if MD[1] == 0 or (k*period*power((c/MD[1],4)) == 0.

Mike