Indicators: LinearRegressionChannel

 

LinearRegressionChannel:

Custom instrument of the linear regression. LR line, Support and Resistance lines values are in the buffers

Fig.1 The LinearRegressionChannel indicator

Fig.1 The LinearRegressionChannel indicator

Author: Nikolay Kositsin

 
When compiling the indicator it gives error - ambiguous access, can be one of: linearregressionchannel.mq5 60 33

 

Hi, Mr. Nikolay

Good morning from Rio de Janeiro

I am currently exploring the Regression channel indicator and found your excellent code for an indicator in this linear regression characteristc for MT5.

First of all, congratulations for the excellent code and for generously sharing your hard work.

After starting, 2 errors I had to be corrected regarding ENUM declarations, Fixed it.

However, I have noticed that the channel did not update its condition for every bar.

I took the liberty to alter the code and it is now updating the channel for every bar, for the total bars inputed.

It is now working as I expected and I intend to explore it together with other trend indicators in order to maximize the probability of forecasting the price directions.

Thanks again for your generosity in sharing

Salustiano Leal

Rio de Janeiro, Brazil

 
Hi, I can't load the indicator from the library into the terminal.
 
Tankarotrader #:
When compiling the indicator it gives error - ambiguous access, can be one of: linearregressionchannel.mq5 60 33

KKAAZZOO #:
Hi, the indicator from the library is not loaded into the terminal.

In line 50 and further, the enumeration is defined, where the predefined value MODE_CLOSE is used.

Let's fix it like this:

//+-----------------------------------+
//|| declaring an enumeration |
//+-----------------------------------+
enum ENUM_USER_PRICE
  {
   USER_PRICE_CLOSE=MODE_CLOSE,  //Use close
   USER_PRICE_HIGH_LOW           //Use high and low
  };
//+-----------------------------------+
//| INPUT PARAMETERS OF THE INDICATOR |
//+-----------------------------------+
input ENUM_USER_PRICE UserPrice=USER_PRICE_CLOSE; //Price option
input uint  barsToCount=50;  //Number of bars to calculate
//+-----------------------------------+

Now in line 194 you can do it like this:

if(UserPrice==(ENUM_USER_PRICE)MODE_CLOSE)

or like this:

if(UserPrice==USER_PRICE_CLOSE)

- makes no difference. Because the custom USER_PRICE_CLOSE is equal to the standard MODE_CLOSE. Only with the first option you need to specify the type of enumeration variable ENUM_USER_PRICE, otherwise there will be a warning about different types.

The file is in the trailer.