PureBytes Links
Trading Reference Links
|
At 12:20 PM -0400 6/9/98, Peter Gibson wrote:
>The Easy Language manual has two linear regression slope functions. The
>first is LinearRegSlope(Price,Len). The second is LinRegAngle(Price,Len)
>which according to the manual is the ArcTangent of the LinRegSlope function.
>
>Can anyone with more math than me explain what taking the ArcTangent does
>and under what circumstances this would be a more useful measure than
>LinRegSlope?
I am not a rocket scientist but I will answer the question anyway. (Maybe
some rocket scientist will correct my attempt.)
Picture a "best fit" straight line sloping up and to the right along a
series of upwardly moving prices.
The LinearRegSlope function returns the slope of this line, defined as the
number of dollars the price is moving up for each bar horizontally. For
example, a returned value of 1.28 on a daily chart would mean that the best
fit line moves up $1.28 for each day, $12.80 for ten days, etc.
The LinRegAngle function returns an angle in degrees (the ArcTangent of the
above slope). This would be the angle of the best fit line on the screen
but only if the vertical scale were set up to be exactly $1 up for each bar
horizontally. For example, if you set up the scales so that each bar on
your screen was 0.1 inch apart, and set up the vertical scale so that the
distance between $23 and $24 was exactly 0.1 inch. Then the angle that the
function returned would be equal to the angle of the best fit line on the
screen. If the function returned a value of 45, this would indicate that
the slope of the line is moving up at a 45 degree angle. I would consider
this fairly useless as the angles would change if you changed the scaling.
When in doubt about a function, it is usually easy to write a simple
indicator in TradeStation and print the result to see what happens.
For example, I wrote the following indicator:
Value1 = LinearRegSlope(Close, 3);
Value2 = LinearRegAngle(Close, 3);
Print(Date:6:0, Value1:6:2, Value2:6:2);
Plot1(0,"");
and ran this on a daily price chart. It printed a line in the Print Log for
each daily bar so I could easily see what happened.
Bob Fulks
|