Linear regression is a statistical tool used to help predict future values from past values. It is commonly used as a quantitative way to determine the underlying trend and when prices are overextended. A linear regression trendline uses the least squares method to plot a straight line through prices so as to minimize the distances between the prices and the resulting trendline. This linear regression indicator plots the slope of the trendline value for each given data point.
The best fit line associated with the n points (x1, y1), (x2, y2), . . . , (x_{n}, y_{n}) has the form y = mx + b
\[slope\;=\;m\;=\;\frac{\sum_{i=1}^{n}(x_{i} - \bar{x})(y_{i} - \bar{y})}{\sum_{i=1}^{n}(x_{i} - \bar{x})^{2}}\]
\[intercept\;=\;b\;=\;\bar{y} - m\bar{x}\]