Indicators: Linear regression slope

 

Linear regression slope:

Linear regression slope normalized to SMA (simple moving average).

the SMA normalization was chosen for the indicator. Also, because of very small values of the LRS, the indicator values are calculated and plotted in parts per 100 thousand to fit roughly into the range of -100 to +100.

Linear regression slope

Author: Vladimir

 
- How do you get another pair's LRS into this window? the LRS of another pair? To get a multi - LRS type. Thanks.
 
Automated-Trading:

Theslope of linear regression:

Author: Vladimir

A why so complicated ???????

The starting point of the regression will be 3*Lwma-2*Sma

The end point of regression will be 4*Sma-3*Lwma

hence the angle will be( start point - end point)/period

((3L-2S)-( 4S-3L))/period -->(3L-2S-4S+3L)/period -->6*(L-S)/period-->(6/period)*(L-S).

In relative values the required angle is the difference Lwma-Sma, and in absolute values it is multiplied by the coefficient 6/period.

PS there is also a nuance since the zero point LR[0] and the end point LR[period] it turns out that the number of points period+1,

then this is the way to calculate the waveform or vice versa, if the waveform is calculated by period, then divide by period-1.

 
Urain:

And why so complicated ???????

The starting point of the regression will be 3*Lwma-2*Sma

The end point of the regression will be 4*Sma-3*Lwma

hence the angle will be (start point - end point)/period

((3L-2S)-( 4S-3L))/period -->(3L-2S-4S+3L)/period -->6*(L-S)/period-->(6/period)*(L-S)

In relative terms, the desired angle is the difference Lwma-Sma, and in absolute terms it is multiplied by the factor 6/period.

PS and there is also a nuance since the zero point LR[0] and the end point LR[period] it turns out that the number of points period+1,

then this is the way to calculate the waveform or vice versa, if the waveform is calculated by period, then divide by period-1.

It is not difficult. Instead of ready-made SMA and LWMA I used my own codes to calculate the simple sum and weighted sum. There is nothing new in the indicator except normalisation. Try to build a regression slope for EURGBP and USDJPY without normalisation and you will see why normalisation is needed.
 
gpwr:
It doesn't seem to be difficult. Instead of ready-made SMA and LWMA I used my own codes to calculate the simple sum and weighted sum. There is nothing new in the indicator except normalisation. Try to build a regression slope for EURGBP and USDJPY without normalisation and you will see why normalisation is necessary.

I personally solved this question for myself by multiplying the result by 1/Point of the desired instrument,

It turns out that the value is calculated in points and does not depend on the instrument features, as they are already taken into account.

 
Urain:

I personally solved this question for myself by multiplying the result by 1/Point of the instrument I was looking for,

It turns out that the value is calculated in points and does not depend on the tool features, as they are already taken into account.

It works this way too, though not as good as normalisation on the prices themselves or their average. It is a matter of taste: one likes numbers in pips, the other in per cent.

 
 
Automated-Trading:

Theslope of linear regression:

Author: Vladimir

For some reason the indicator does not compile for me. It gives:

can't open "C:\Program Files (x86)\MetaTrader 5\MQL5\Indicators\Examples\Linear_Regression_Slope.ex5" output expert file Linear_Regression_Slope.ex5 1 1

What can it be?

 
Idalgo:

For some reason the indicator does not compile for me. It says:

can't open "C:\Program Files (x86)\MetaTrader 5\MQL5\Indicators\Examples\Linear_Regression_Slope.ex5" output expert file Linear_Regression_Slope.ex5 1 1

What can it be?

Win 7 does not find the path to ex5. In this version, mt5 looks for ex5 files in some enchanted folder C:\Users\You\AppData\Roaming..... You need to put new indicators and Expert Advisors there and compile there. This is a known problem. Ask mt5 developers to fix it.
 
gpwr:
Win 7 does not find path to ex5. In this version, mt5 looks for ex5 files in some enchanted folder C:\Users\You\AppData\Roaming..... You need to put new indicators and Expert Advisors there and compile there. It is a known problem. Ask mt5 developers to fix it.

It's all about the new security policy of Windows developers. The help says what to do in such cases.


 
Rosh:

It's all about the new security policy of Windows developers. The Help describes what to do in such cases.


Thank you. I knew about that command. There seems to be a lot of people here running into this problem. Instead of telling everyone what to do and where to read, please enter this string in the register when installing mt5 if possible. And one more recommendation. I know that vin 7 does not allow guests to change folders in Programme Files. I have been wondering for a long time: why not make mt search for all these indicators, experts and libraries in My Documents? I had a disc crash two months ago and it turned out that my backup system copied all folders inside My Documents and not one of Program Files. This is understandable: many (if not all) backup systems assume that user data is not usually stored under Program Files. I've lost a lot of my mt4 development because of this problem. Or even better: add a configuration parameter in mt5 where the path to the MQL5 folder is specified and let people decide where to store this folder. By default, let it be created in My Documents.