|
Michael McNaughton
2013-05-10 04:11:54
|
|
I like stocks that have entered into a narrow trending channel. As such these stocks should conform closely to the linear regression line taken over period of
interest (probably the last n bars or so).
******************************************************************************************
if the regression line is y=ax+b
and is the best fit over the period
//ref(close,period) would be the close at the beginning of the period
// b would be the value of the linear reg. line at the beginning of the period
sumsq=0;
For n=0 to period
linregr=b+n*a; value of linear regression line a point x
sumsq+=(ref(close,x-period)-linregr)^2;
end
answer=sqrt(sumsq); // the smaller this number is, the closer the data is to the linear regression line
******************************************************************************************
I hope somebody can understand this "structured english" rambling and point me in the right direction.
Any insights?
|
|