PureBytes Links
Trading Reference Links
|
Oops, Len=1 will still give you a divide by zero error. Log(1)=0. So,
try...
If Rng>0 and k>0 and Scale>0 and Len>1 then
Hurst = Log(Rng/(k * Scale)) / Log(Len);
--
Dennis
I wrote:
>
> > Hurst = Log(Rng/(k * Scale)) / Log(Len);
>
> It's always a good idea to check for zero with any input or var that can
> make your calc puke. In this case, any of the 4 terms could do it. You
> also can't take the log of a negative number. So.....
>
> If Rng>0 and k>0 and Scale>0 and Len>0 then
> Hurst = Log(Rng/(k * Scale)) / Log(Len);
|