PureBytes Links
Trading Reference Links
|
All the examples you posted show bad coding practices.
> Value1 = (Summation(Square(Close), Length)) - ((calcA(Length) *
> Summation(Close, Length))) - ((calcB(Length) *
> Summation(X * Close, Length)));
> Value2 = Length - 2;
> StdErr = SquareRoot(Value1 / Value2);
Always check for divide by zero. Also check for anything else that can
bust the code. In the example above any length less than or equal to 2
will give an error, either trying to divide by zero or take the
squareroot of a negative number. If value1 goes negative, that will also
try to take the squareroot of a negative number. I'm too lazy to rewrite
the code but these are the kinds of checks you can run to make it more
bulletproof:
If Length > 2 and FracPortion(Length) = 0 then begin.....
If Value1 > 0 then begin.....
If Value2 > 0 then begin.....
Etc.
--
Dennis
|