You are on page 1of 10

EQUITY FUND MANAGEMENT

TECHNICAL ANALYSIS
LINEAR REGRESSION INDICATORS
Submitted to Dr. Akshay Damani
Date: 21/01/2021

By TYBBA-A Admin Group 3


Deeksha Padhi, A011 (74021018436)
Dhairya Jain, A012 (74021018235)
Table of Contents Dhruv Bhatia, A013 (74021018099)
Hardik Thukral, A014 (74021018613)
Harjas Anand, A015 (74021018048)
Particulars Page Numbers
About Linear Regression 2

Major Uses of Linear Regression 2


Least Square Method 2

Why is LR used in technical analysis? 2

Types of indicators: 3

I. Linear Regression Central, Upper and Lower Lines 3

II. Linear Regression Slope Indicator 5

III. Linear Regression Angle Indicator 6

Limitations of LR 8

Analysis of stock prices 8

Conclusion 9

References 9

Page | 1
About Linear Regression
The history of linear regression can be traced back to early 19th century when the method of
least squares was first published by Adrien-Marie Legendre.
A linear regression statistical model aims to establish a relationship between one or more
variables. These explanatory variables are also known as dependant and independent
variables. The analysis has extensive applications in economics, pricing, forecasting, machine
learning and even artificial intelligence. The use of simple linear regression in the finance
industry started from the most famous and widely known Capital Asset Pricing Model.

Major Uses of Linear Regression


(1) Determining the strength of predictors
First, the regression might be used to identify the strength of the effect that the independent
variable(s) have on a dependent variable.  Typical questions are what is the strength of
relationship between dose and effect, sales and marketing spending, or age and income.
(2) Forecasting an effect
Second, it can be used to forecast effects or impact of changes.  That is, the regression
analysis helps us to understand how much the dependent variable changes with a change in
one or more independent variables.  A typical question is, “how much additional sales income
do I get for each additional $1000 spent on marketing?”
(3) Trend forecasting
Third, regression analysis predicts trends and future values.  The regression analysis can be
used to get point estimates.  A typical question is, “what will the price of gold be in 6
months?”

Least Square Method


By using the least square method to plot the regression line, we are minimizing the sum of the
distance between the line and all the data points. This line is an accurate description of the
data set.
In excel, we use the least square method to calculate slope and intercept of the data series.
The function =LINEST nested with =INDEX is used, which calculates the slope (when
Row=1) and the intercept (when Row=2). The function =INDEX(LINEST(known_y’s),1) is
used to calculate rolling slope and intercept, that can be plotted using a 2D line chart and can
be used as a lagging indicator.

Why is LR used in technical analysis?


After a particular time-frame is decided, the linear regression lines move along the closing
price (or any target) as a lagging indicator. This means that significant ups and downs are
evident after they have occurred. The mean of the set of moving closing prices changes as it
is not always the centre of the data. When a mean value is recognized, traders try to
determine how frequently and to the degree by which the stock price deviates from the mean.

Page | 2
This analysis shows the trader when a security is bought a lot and thus, the price deviates
above the mean or the security is sold a lot and thus, deviates to the mean or falls below it
mean. The three lines viz., Linear Regression Central Line, Linear Regression Lower Line
and Linear Regression Upper Lines creates channels and shows traders the prevailing price
trend. Using a variable or moving regression path, channels can be created by setting the
standard deviation at 1 (i.e., 68%) or 2 (i.e., 95%).
The closing price data is smoothened out with the calculation of slope and it works as an
oscillator. Fluctuations of the oscillator above or below ‘0’ can be used to make trade
decisions.

The benefit of using the linear regression indicator over a simple moving average is that it has
less delay making it respond quickly when the trend changes its direction.

Types of indicators
1. Linear Regression Central, Upper and Lower Lines
 Linear Regression Central Line: A Linear Regression Line is a straight line that
best fits the prices between a starting price point and an ending price point. A "best
fit" means that a line is constructed where there is the least amount of space between
the price points and the actual Linear Regression Line. The Linear Regression Line is
mainly used to determine trend direction. When prices deviate above or below, traders
may expect prices to go back towards the Linear Regression Line. As a consequence,
when prices are below the Linear Regression Line, this could be viewed by some
traders as a good time to buy, and when prices are above the Linear Regression Line,
a trader
might sell.

 Upper Channel Line: A line that runs parallel to the Linear Regression Line and is
usually one to two standard deviations above the Linear Regression Line.

 Lower Channel Line: This line runs parallel to the Linear Regression Line and is
usually one to two standard deviations below the Linear Regression Line.

The width of the channel is based on the high or low that is the furthest from the linear
regression. There are two types of linear regression channel, depending on the direction of the
trend – the bullish and the bearish linear regression channels. These two types of regression
channels are defined based on the linear regression slope. Technical and quantitative analysts
have applied statistical principles to the financial market.-  The bullish linear regression
channel refers to bullish trends. In this case, the price is increasing and the slope of the linear
regression is upwards. The bearish linear regression channel is opposite to the bullish
regression channel and it refers to bearish trends. For the bearish scenario, the price is
decreasing and the slope of the regression channel is downward.

The upper and lower channel lines contain between themselves either 68% of all prices (if 1
standard deviation is used) or 95% of all prices (if 2 standard deviations are used). When
prices break outside of the channels, either: Buy or sell opportunities are present. Or the prior

Page | 3
trend could be ending. The following steps are to be followed to graphically plot the
regression lines.

Step 1: Decide a time-frame


Depending on the wave length that any investor is aiming to track, they should decide on a
time-frame. 14, 25 and 50 days are a few examples of time periods.
Step 2: Calculate Slope and Intercept
Rolling slope and intercept is calculated on the closing price using these excel functions:
=INDEX(LINEST(known_y’s),1) to get the slope of the array of closing prices
=INDEX(LINEST(known_y’s),2) to get the intercept of the array of closing prices
Step 3: Calculate Standard Deviation
The standard deviation of closing prices can be calculated using the following excel function:
=STDEV.S(number1, number2, …)
Step 4: Calculate upper, lower and central lines
The slope, intercept and standard deviation calculated, is used to plot the linear regression
indicator channel. The following formulas are used to calculate the data points for the 3 lines:
Central Line = Intercept + (Slope * Time Period)
Lower Line = Central Line – (Standard Deviation * No. of Standard Deviations)
Upper Line = Central Line + (Standard Deviation * No. of Standard Deviations)
Step 5: Plotting the graph
A 2D line chart is plotted with dates on the x-axis and price on the y-axis.
The below output is a result of 50-day time period of Titan Company Ltd. assuming 1-sigma
standard deviation.

Figure 1: Linear Regression Lines

Page | 4
The property of mean reversion is of significant importance while making trade decisions
using the three linear regression lines. Over the last 10 months, Titan Company’s stock price
has more or less, stayed within the range of the lower and upper lines. When the stock price
attempts to breakout the 1-sigma upper deviation line from below, the price soon reverts back
to the rolling mean value. Similarly, when the price falls below the lower line, traders buy the
stock, thus bringing the stock’s price back to the mean value.
A more advanced version of the earlier three regression lines is used by many traders in order
to identify entry and exit points, to make profitable trades. The below graph is a 50-day linear
regression indicator of Titan Company Ltd. adjusted for 1-sigma and 1.5-sigma standard
deviation events.
The 1.5-sigma lines act as upper and lower regression lines and 1-sigma lines act as entry and
lines. When the closing price rises to the two upper lines, the trader can mark them to be
profitable exits. On the other hand, the when the closing price cuts the entry line from below,
the trader can buy the security and place a stop loss on the lower regression line.

Figure 2: Entry and Exit Points


The price towards the right end of the graph attempts to rise towards the exit point. A good
trade would’ve been to buy the shares of Titan Company on 24 th November and square off
after it reaches the target of either 1-sigma or 1.5-sigma.
2. Linear Regression Slope Indicator
As against the moving regression lines, the linear regressions slope indicator is more of a
movement oscillator. This means that the value of slope fluctuates above or below a certain
decided level (mostly 0). The momentum is positive when the value of slope cuts the central
line of 0 from below and continues to move upwards. Likewise, the momentum is negative
when the value of slope slips below 0. The l inear regression slope indicator is used to define
the direction and the strength of the trend. 

The value of slope is calculated using the =LINEST function on excel as explained earlier.
The oscillator is plotted using a separate 2D line graph and placed below the graph that is
tracking the closing price.
The below graph is a 14-day momentum oscillator calculated using the slope of closing
prices.

Page | 5
Figure 3: Linear Regression Slope Indicator
A 14-day moving slope is seen to oscillate above and below the central line very often, thus
giving traders opportunities to enter and exit the trade. When the slope line cuts the central
line from below, a short-term uptrend is anticipated, and creating a long position is the aim.
Similarly, when the slope line cuts the central line from above, a downward trend is in place.
3. Linear Regression Angle Indicator
Linear Regression Angle is a directional movement indicator which defines a trend at the
moment of its birth, and additionally defines trend weakening. The indicator calculates the
angle of the linear regression channel and displays it in a separate window in the form of
histogram. The signal line is a simple average of the angle.
The angle is the difference between the right and left edges of regression (in points), divided
by its period.
The angle value above 0 indicates an uptrend. The higher the value, the stronger the trend. A
value below 0 indicates a downtrend. The lower the value, the stronger the downtrend.
When a time-frame is decided and the slope is calculated using the aforementioned excel
function, the value of the regression angle can be calculated using the following excel
function:
=DEGREES(ATAN(number))
The value of slope for the day’s closing price is put in the ATAN function and the result is
converted into degrees using the DEGREES function.
A 2D stacked line chart is plotted with dates on the x-axis and price on the y-axis. The value
of the angle line (orange) in Figure 4 is plotted along the closing price and the deviation is
represented with a stacked display.
The below graph is a 14-day regression angle indicator calculated using the slope of closing
price of Titan Company Ltd.

Page | 6
Figure 4: Linear Regression Angle Indicator
The value of the angle ranges from -88o to +86o and the deviation is represented by the
movement of the angle line below or above the closing price line respectively. A fall in the
closing price of Titan Company Ltd. is caught by the negative slope, thus resulting in a
negative regression angle and ultimately giving the trader a hint to short sell.
These indicators can be used independently or can be combined to give a more accurate
prediction. The accuracy of an indicator can be confirmed and decision can be taken to add or
remove indicators that enhance each other and give an accurate prediction for the security in
question.
The regression slope and angle indicators can be plotted on two separate graphs and placed
one below the other.

Figure 5: Linear Regression Angle and Slope Indicator


The oscillator is closing in on the central line, indicating a downtrend. However, the gap in
the stacked line graph has not reduced or fallen below zero. A trader using these two
indicators together would suspect a downtrend, but would like to wait for a couple of days to
minimize the risk of loss.

Page | 7
Limitations of Linear Regression Indicators
 The future is shown as a linear increase which is not true as if you observe the actual
values you see a jump up and a fall down in the prices. There is a lot of variability in
the actual data but a standard increase in the forecasted values.
 The line goes only one way which means if the past has been of an average increase
over a period of time then the future will also show the average increase over the next
period. In reality, there is always a danger of trend reversal which the linear forecast
can never reveal.
 This indicator alone isn’t sufficient to deduce a price movement for a stock and is
generally used only as a confirmation indicator that is used to supplement other
indicators.

Stock Analysis
The primary form of Linear Regression Channel analysis involves watching for price
interactions with the three lines that compose the regression indicator. Each time that the
price interacts with the upper or the lower line, we should expect to see a potential turning
point on the chart. For swing traders, this means that you want to enter after a retracement in
the direction of the trend, and exit when price approaches the opposite end of the channel.
1. As seen in the case of Info Edge, we can see that the stock price movements have been
following a bearish trend with signs of reversal in the upcoming future. It is further
rectified by the latest price movement shown on January 21, 2021 where the stock
deviated from its normal bearish flow and formed a bull candle. This shows the sign of a
trend reversal and it would be apt to take a long position in this stock with the central line
and the upper line acting as target levels for the stock.
2. In case of Nestle, multiple levels have been achieved to give further clarification on the
price movements of the stock. We can see that the linear regression pattern formed on 23
September 2020 perfectly followed the price movements predicted by the tool. Also, for
the current state the apt strategy would be based on the next day’s candle. If the trend
reversal and reaches the entry point line, a long position would be suitable according to
the target levels. An aggressive trader may choose target levels different as seen in the
graph and a passive trader may set the central line as the first target level and the target 1
as the second target level.
3. For ITC, a shorter period for linear regression movements have been studied to measure
the volatility in the short term. As seen ITC had just recently breached the Upper Linear
regression line and has started correcting itself towards the mean as seen in the latest
price movements. So, a short position would be recommended as the analysis show a
possible downtrend in the near future
4. For ICICI, the linear regression slope indicates a bearish trend and the investor can wait
for the stock to go below the 0-slope level and thus on that basis can go on to short the
stock. Though if the price movements are bullish in the next 1-2 days a long position
would be suggested.

Page | 8
Conclusion
As seen, Linear regression helps us in finding out the price movements of stock and
identifying the trend that a stock may end up following. A linear regression line should not
be used a system itself. Rather it should be used in the context of a larger trading
system – mechanical or otherwise – that uses other technical indicators, price,
candlestick patterns, support and resistance levels, and/or fundamental analysis to
improve the accuracy of trading decisions. But it can be more useful than normal moving
average as a fit regression line would be better in indicating price movements when compared
to linear moving average which justifies the trend on the basis of the average of the closing
price of stocks. Thus, it is more responsive than simple moving average and a trader can
incubate this in his/her strategy replacing SMA by making necessary adjustments. Another
advantage of using linear regression is that it considers the deviations of the stock movements
and thus can be easily adjusted for volatility with the help of offset option. Thus, linear
regression can be used to create a solid strategy when used with proper mix of other
indicators. The beauty of linear regression is that the security's price and time period
determine the system parameters. Use these tools and the rules defined within this article on
various securities and time frames and you will be surprised by its universal nature.

References
E. Norris (2020), “The Linear Regression of Time and Price”, Investopedia
I. Mukherjee (2018), “Linear Regression Slope Indicator Strategy”, Stock Maniacs
Allwyn (2020), “Linear Regression to Forecast Stock Prices”, Analytics Vidhya
X Study Documentation, “Linear Regression Angle”, Trading Technologies
X Study Documentation, “Linear Regression Slope”, Trading Technologies

Page | 9

You might also like