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

LinRegSlope Problems



PureBytes Links

Trading Reference Links

Maybe everyone already knows about this but I didn't, so I am including the
following. (I use 7.2 EOD.)

I use linear regression and the slope of linear regression lines in many of
my indicators. I usually start development in MetaStock and transfer them to
Excel due to the greater precision possible in Excel. While developing an
indicator, I found that using the LinRegSlope command to find the slope of
lines other than the CLOSE of the prices can lead to the wrong number being
returned.

1.  I did a 14 period linear regression line study of the prices on a chart
and got a slope
of 0.003192. I confirmed the line study slope by putting LinRegSlope(C,14)
in a Custom Indicator and correctly got a slope of
0.003192 .

2.  I then plotted LinearReg(C,14) in a separate inner window by itself and
did a 10 period linear regression line
study of this line, and got a slope of 0.0035441. To confirm this
slope, I then plotted LinRegSlope(LinearReg(C,14),10) in a Custom Indicator
and got a slope of
0.00009549 . It should have been 0.0035441 . Way off. Over a factor of 38
different.

Until this is fixed (?), you might want to go
back through all your indicators and strip out all LinRegSlope commands of
lines other than the CLOSE of prices. Any and all Experts and Explorations
containing LinRegSlope should be suspect also. I currently find the linear
regression slope of plots (other than the CLOSE, which works OK), by
using the program:

P2:=Input("LinRegSlope Periods",2,250,13);
V1:={Your line plot}
Slope:=((P2*(Sum(Cum(1)*V1,P2)))-(Sum(Cum(1),P2)*(Sum(V1,P2))))/((P2*Sum(Pwr
(Cum(1)
,2),P2))-Pwr(Sum(Cum(1),P2),2));

-Corey Saxe