LinRegSlope
- linear regression slope

Statistical functions
(AFL 1.4)


SYNTAX LinRegSlope( ARRAY, periods )
RETURNS ARRAY
FUNCTION Calculates linear regression line slope 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

References:

The LinRegSlope function is used in the following formulas in AFL on-line library:

More information:

Updated on-line reference