Quantcast
Channel: Algorítmico y mecánicos Estrategias Forex | OneStepRemovedRupert Hadlow – Algorítmico y mecánicos Estrategias Forex | OneStepRemoved
Viewing all articles
Browse latest Browse all 24

Charting a Linear Regression

$
0
0

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

  1. Open your Metatrader platform and click on TOOLS, HISTORY CENTER.
  2. Choose the relevant pair for your regression analysis. Once you have chosen the time frame, click on EXPORT and SAVE the spread sheet.
  3. 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.
  4. Click INSERT and choose SCATTER. A drop down menu will appear. To get a true reflection, click on SCATTER WITH ONLY MARKERS.
  5. 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.
  6. Navigate to TREND LINE. A drop down menu will appear with several options. Choose LINEAR TREND LINE. The regression line will now appear.
Excel linear regression on EURUSD M5 data

Excel draws a linear regression of the EURSUD prices using data from MetaTrader M5 charts

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

  1. Open the desired chart and time frame in Metatrader
  2. Click on INSERT and CHANNELS. You will then be provided with a list. Choose LINEAR REGRESSION.
  3. 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.
  4. You will notice that the regression line will appear and adjust according to the data. One standard deviation will also appear.
  5. 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.
A linear regression of the EURUSD

MetaTrader interprets the price movements and draws a liner regression

Recommendation

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.

The post Charting a Linear Regression appeared first on MetaTrader Expert Advisor.


Viewing all articles
Browse latest Browse all 24

Trending Articles