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

Re: sve.lr function



PureBytes Links

Trading Reference Links

Bob:

>>A much faster version that uses no loops (except for initialization) can
>>be found at
>>
>>http://unicorn.us.com/trading/src/_LinRegSlopeSFC.txt
>
>That version assumes the X axis = CurrentBar. His version did not make that 
>assumption.

You mean it assumes the current bar corresponds to X=0.  This is
merely a convenient way to get the value of the regression line
at the current bar.  Once you have the slope, you can make the Y
intercept any place you want.  Defining it at the currentbar is
simply a convenience.

>Below is listed my function for doing this. It uses all the tricks I know of 
>to improve accuracy and speed. It also returns the standard error value in 
>addition to the slope and intercept. I have tested it on TS 8 but not on 
>TS2000i.

Thanks.  By the way, in my tests of this sort of thing, I found that
you can easily recalculate the loop every 1000 bars instead of 100
bars.  At 1000 bars, the accumulated error is so insignificant, one
doesn't notice.

-Alex