# Linear Regression Slope

## Introduction

Linear regression is a common statistical technique used to identify the strength and direction of a dominant market trend. Linear Regression Slope is one of the indicators calculated by using the Linear Regression technique. This technique is applied in technical analysis to determine if the market trending up or down and what is the intensity of the rise or fall, given the past trend of prices.

The Linear Regression Slope is a centred oscillator type of indicator that is similar to momentum indicators. As indicated by the name of the type of indicator, it “oscillates” or fluctuates above and below a central line drawn at 0. In general, the momentum is positive when the Slope is above 0 and negative when it is below 0. It can be used to measure the strength or weakness and direction of the momentum.

## Calculation of Linear Regression Slope

The Linear regression statistical technique is used for calculating the value of one dependent variable when one has the values of independent variable or variables M. This is in the form of a straight line which “best fits” the data points of prices available, using the least squares technique. The Linear Regression Slope is derived by calculating the slope value of linear regression lines for a defined number of days (X) at each bar using the values for that bar and the previous X-1 days. This is an intense calculation process as it involves calculation of regression lines and their slope value at each bar. It is used to analyse when the market is deviating from the trend. The Slope is typically drawn as a line chart or a histogram below the price chart and is not overlaid on the chart itself. The Linear Regression Slope thus drawn illustrates the trend of the prices and direction and strength of the trend.

The prices used for calculating the regression can optionally be smoothed using a moving average calculation. If the prices are not smoothed, then the actual price can be used. In addition, a forecast for a certain period can also be calculated and used. The slope of each such regression line calculated is used as the value for that bar.

The slope is usually normalized to show percentage change at each bar by multiplying the value by 100 and dividing it by the price. Without normalization, the Slope would show absolute price change calculated using Regression. Normalizing allows for comparison of the Regression Slope of different securities trading in different price ranges. For example one stock may be trading at 100 and the other at 200. The Slope value of 1 with normalization is 1 in the first case and .5 in the second case.

This is calculated as follows:

Slope = Change in Price / Bar
Normalized Slope = % Change in Price / Bar

Usually the slope indicator can be used in conjunction with other indicators such as Linear Regression Forecast or Simple Linear Regression along with the Regression channels, which are overlaid on the price chart by drawing the Upper and Lower bands. Regression Slope is also used with momentum oscillators such as Williams %R.

## Specifications

The Linear Regression Slope can be customized by optionally smoothing the price data using a moving average of a defined number of days prior to calculating the regression slope value for that bar. Moreover, a forecast for a defined number of days can also be optionally calculated and the slope of the resulting regression line is taken as the value of the bar. Typically the Linear Regression Slope is presented as a Line chart or Histogram below the price chart. A reference line is drawn at 0. Depending on whether the slope is positive or negative, the slope value will oscillate above or below 0. If using a histogram, the slope can be further customized by drawing the bars using Uptrend and downtrend colours for better trend identification. So a slope value which is more than the previous slope value can be coloured in the Uptrend colour, and one which is less than the previous slope value can be coloured in the downtrend colour.

## Lengths and timeframes

Linear Regression Slope is mostly a lagging indicator. It follows the trend of the market and there is some delay. It is used for measuring the trend strength or weakness and its direction. The lengths or timeframes used can change depending on the trend being analysed. It can range from 10 days for a short term trend, to 100 days for medium trend to 250 days for a long term trend. Generally a longer Slope regression period is used with a shorter regression period for a momentum oscillator where the slope identifies the longer overall trend and the momentum oscillator identifies potential entry point. An example of such an oscillators to be used is Williams %R. So when a 100 day Slope becomes positive and the 10 day William %R goes below -80 signalling oversold position, this is a signal that can be used for entering the stock.

## Trend identification / Crossovers

As mentioned, Slope is used to measure the trend. By definition, a positive slope is an uptrend and a negative slope is a downtrend. Additionally, the sharper the rise (or fall) in price, the higher will be the slope value (either higher positive or higher negative value).