Linear Regression can be an effective tool when defining the overall momentum or trend of a series of prices. It can be adapted to all data. Fields outside of trading, including risk management and statistics, use the same statistical technique. Insurance providers will commonly plot the relationship between claims and age groups to determine premium levels.
To put it into perspective, if there were five people in a group who each owned two television sets, one person who owned no tv and two people that owned four tv sets, then the linear regression on a rough basis would indicate the trend is just slightly above the two sets. The standard error or deviation in this case would be the two outside samples of no tv and four televisions.
Can regression be an effective tool for trading on a longer term basis or is it too susceptible to market volatility and future pricing? To understand how linear regression really works, we need to chart the channel and its standard deviation levels.
The first tutorial below looks at a scatter graph in excel and how to plot a linear regression. Please note that it does not include the standard deviation channels.
Charting a Simple Regression in Excel
- Open your Metatrader platform and click on TOOLS, HISTORY CENTER.
- Choose the relevant pair for your regression analysis. Once you have chosen the time frame, click on EXPORT and SAVE the spread sheet.
- Open the spread sheet and highlight the two relevant columns you would like to use in the scatter chart. In the diagram above we used time (minutes) and price.
- Click INSERT and choose SCATTER. A drop down menu will appear. To get a true reflection, click on SCATTER WITH ONLY MARKERS.
- A chart will appear with dots representing the distribution of pricing data. To decipher the linear regression, highlight the chart and click on LAYOUT in the excel menu.
- Navigate to TREND LINE. A drop down menu will appear with several options. Choose LINEAR TREND LINE. The regression line will now appear.
As discussed previously, the excel chart will only give a basic trend and will not supply the user with detailed standard deviations. It is also recommended that you do not highlight too much data for a realistic short term interpretation.
We specified eight hours of five minute data on the EURUSD cross in the above diagram.
Charting Linear Regression in Metatrader
- Open the desired chart and time frame in Metatrader
- Click on INSERT and CHANNELS. You will then be provided with a list. Choose LINEAR REGRESSION.
- Hold down your left mouse button and drag the linear regression over the desired time period. In the above diagram, we chose a linear regression with a starting date of the 13th May at 10:30.
- You will notice that the regression line will appear and adjust according to the data. One standard deviation will also appear.
- If you would like a second deviation channel on your chart, navigate back to the top of the terminal menu and click on INSERT – CHANNELS and choose Standard Deviation. You will then need to drag the standard deviation channel using your left mouse button and specify the same time period.
It is recommended when trading using regression, that you specify a shorter range so as to manage the volatility. As prices shift, so will the channel, and profit potentials could quickly turn to losses.
It is important to always keep stops tight in case of violent swing backs in the price.