Indicators: Regression Channel with variable polynomial degree, Indicator & EA

 

Regression Channel with variable polynomial degree, Indicator & EA:

This is a fast adaptation of old source to MetaTrader 4 b600 environment.
  • i-Regr: Linear Regression Channel consists of two parallel lines, equidistant up and down from the line of linear regression trend. The distance between frame of the channel and regression line equals to the value of maximum close price deviation from the regression line.
  • e-Regr: MetaTrader Expert Advisor e-Regr based on Regression Channel MetaTrader Indicator. Trade signals: If price lower than under line - Buy, If price bigger than upper line - Sell, TakeProfit by average line.

Expert Advisor trade signal

Author: graziani

 

Forum on trading, automated trading systems and testing trading strategies

Indicators: Linear Regression Channel

newdigital, 2013.09.27 09:39

Linear Regression Channel


Similar to the 200-day Moving Average, large institutions often look at long term Linear Regression Channels. A Linear Regression Channel consists of three parts:

  1. Linear Regression Line: A line that best fits all the data points of interest.
  2. 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.
  3. 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 multi-year chart of the S&P 500 exchange traded fund (SPY) shows prices in a steady uptrend and maintaining in a tight one standard deviation Linear Regression Channel:


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:

  1. Buy or sell opportunities are present.
  2. Or the prior trend could be ending.
Linear Regression Channel Buy Signal

When price falls below the lower channel line, a buy signal is usually triggered.

Linear Regression Channel Sell Signal

An opportunity for selling occurs when prices break above the upper channel line.

Other confirmation signs like prices closing back inside the linear regression channel could be used to initiate buy or sell orders. Also, other technical indicators should be used to confirm.

Trend Reversals

When price closes outside of the Linear Regression Channel for long periods of time, this is often interpreted as an early signal that the past price trend may be breaking and a significant reversal might be near.

Linear Regression Channels are quite useful technical analysis charting tools. In addition to identifying trends and trend direction, the use of standard deviation gives traders ideas as to when prices are becoming overbought or oversold relative to the long term trend.


 
newdigital:

I run this in MT4's Strategy Tester and the EA still seems not to do anything at all. I looked at the code and it looks solid... but no trades happen at all.

Well it does open one or two, but they're completely out of step with the i-Regr indicator.

 
very good indicator
 
newdigital:
Thanks for the info
 
Can someone help me? How to retrieve value0, value1 and value3 in this indicator?
 
I also am not getting trades to open automatically.  I imported both the EA (E-Regr) and the indicator (I-Regr) and they are on chart and smiley face on but it wont take trades.  Does anyone know why not?  I checked a couple of charts and started two trades manually...and we will see if this works BUT...no trades open automatically?????  Isnt that the point of an EA?  Thx
 
Interesting EA, i will test it on Demo account.
 

I think this indicator is quite pretty and nice.
But I hope you can add to this indicator a vertical line on the last candlestick.
add a vertical line

 
justin217:
I also am not getting trades to open automatically.  I imported both the EA (E-Regr) and the indicator (I-Regr) and they are on chart and smiley face on but it wont take trades.  Does anyone know why not?  I checked a couple of charts and started two trades manually...and we will see if this works BUT...no trades open automatically?????  Isnt that the point of an EA?  Thx

Compiled on Metaeditor "e-regr" gives error on 'OrderModify' lines. Can you please fix it.
 
EA is not working, please fix the error.
Reason: