LinRegIntercept
|
Statistical functions |
SYNTAX | LinRegIntercept( ARRAY, periods ) |
RETURNS | ARRAY |
FUNCTION | Calculates intercept of linear regression line - the "a"
coefficient in a + b*x (LinRegSlope calculates b) from the ARRAY using periods range. The function accepts periods parameter that can be constant as well as time-variant (array). |
EXAMPLE | x = Cum(1); lastx = LastValue( x ); Daysback = 10; aa = LastValue( LinRegIntercept( Close, Daysback) ); bb = LastValue( LinRegSlope( Close, Daysback ) ); y = Aa + bb * ( x - (Lastx - DaysBack) ); Plot( Close, "Close", colorBlack, styleCandle ); Plot( IIf( x >= (lastx - Daysback), y, -1e10 ), "LinReg", colorRed ); |
SEE ALSO |
The LinRegIntercept function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.