Linear Regression (LINREG)
Category: trend
Calculates the Linear Regression Line (LRL) and its slope by fitting a least-squares line to a historical price series.
Formula
Slope (s) = \frac{n\sum(xy) - \sum x \sum y}{n\sum x^2 - (\sum x)^2} \\ Intercept = \bar{y} - s \cdot \bar{x} \\ LinReg = Intercept + s \cdot (n-1)
Inputs
- i_period (default: 14)
- i_source (default: close)
See signal primitives and every published strategy that uses Linear Regression (LINREG) on WOBR StrategyVerse.