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

Re: fast computation on LinearRegresion and Standard Error



PureBytes Links

Trading Reference Links

At 8:26 AM -0800 11/17/02, Alex Matulich wrote:

>Here's a very fast linear regression slope functions I derived from
>something M. Simms (also on this list) wrote:
>
>http://unicorn.us.com/trading/src/_LinRegSlopeSFC.txt


One problem with this approach is that round-off errors accumulate.

But you can fix this with a simple change:

Instead of:

    if xLen <> Length or CurrentBar <= 1 then begin

use:

    if xLen <> Length or Mod(CurrentBar, 100) = 1 then begin

This re-calculates the full calculation once each 100 bars so
will not allow round-off errors to get very large.

Bob Fulks