Download MetaTrader 5

Linear Regression Indicator

To add comments, please log in or register
Erman Ardianto
1141
Erman Ardianto  

Hi all, I just found a Linear Regression Indicator for metatrader, unfortunately it's in mql, can somebody convert it to mq4? Any help is very appreciated.

Here is the code :

/*[[

Name := linear regression indicator

Author := Copyright e 2004, Nick Bilak, beluck[at]ukr.net

Link := http://bilak.port5.com

Separate Window := No

First Color := Red

First Draw Type := Line

Use Second Data := No

]]*/

Inputs : Rperiod(5);

Variables : shift(0), cnt(0), loopbegin(0), first(True), prevbars(0);

Variables : sum(0), length(0), i(0), mt(0), WT(0), vWT2(0),value(0);

SetLoopCount(0);

// initial checkings

If RPeriod < 1 Then Exit;

length=RPeriod;

loopbegin = 206-length-1;

For shift = loopbegin Downto 0 Begin

sum=0;

For i = length downTo 1 Begin

sum = sum + (i-(length+1)/3)*Close[length-i+shift];

End;

WT=sum*6/(length*(length+1));

SetIndexValue(shift,WT);

End;

Thank you

Sergey Golubev
Moderator
100327
Sergey Golubev  

Check this indicator for MT4 (attached). It should be the same or very similar with yours (attached as well) with iPeriod 5.

Also please look at this post.

Erman Ardianto
1141
Erman Ardianto  

Thank you Newdigital. your help is highly appreciated.

I already check your links twice, but I'm looking for exactly the same Linear Regression which I found on netdania's chart. LSMA so far looks so similar, but I'm afraid that I have to test it for a couple of month or more. And I'm looking for similar Oscillator Indicator which I found on netdania's chart also. Hope you can help me. Thanks

sashazz
12
sashazz  

linear regression

hi newdigital,

now i am hoping to meet you here. this is the indicator (linear regression) that seemingly works like the one i need. i am copying it into indicators folder and nothing happens. any idea why?

thanks.

Sergey Golubev
Moderator
100327
Sergey Golubev  
sashazz:
hi newdigital,

now i am hoping to meet you here. this is the indicator (linear regression) that seemingly works like the one i need. i am copying it into indicators folder and nothing happens. any idea why?

thanks.

You mean post #2?

The first indicator is for MT3.

The second one is for MT4.

Sergey Golubev
Moderator
100327
Sergey Golubev  

It works. I just attach indicator to the chart (MT4) and it works (see image).

Files:
1.gif 22 kb
Erman Ardianto
1141
Erman Ardianto  

Hi sashazz, I found it on Indonesian forum, it's soo similar with LSMA indicator which I found it here. But with this LSMA you can see color changing if trend is changing too.

sashazz
12
sashazz  

it does not look like what i want

thanks devil,

i saw your name somewhere over here looking for linear regression, too. i tried both of your indicators, and i am not sure they can do what i want.

i am not really too much into indicators, this just happen to be the one i need to find in order to follow other guy trading class.

the idea is to use BB together with linear regression, like the one you can see on the picture attached, where white thick line is what i need. then, when it penetrates the BB plus something else, you are getting a trading signal.

i tried probably 20 regression indicators that i found on this forum and they all do something different, from what i need.

the one i need has a setting 4 on this picture, and that is the only setting this indicator has.

to my surpise the other tons of linear regressions i found here, all do something different. maybe after you look at the picture attached you have some idea?

newdigital, thank you for your help. you must be a supernultitasker to cope with all this flow. i tried that one before and it is not what i need. still thanks.

Files:
Erman Ardianto
1141
Erman Ardianto  

Have you try it with different parameter?

sashazz
12
sashazz  

yeah, i will continue to change parameters, but it looks like whatever i do it never penetrates the BB. For BB i need a setting 10, 2 and sma. the whole idea here is to trade from penetrations. again, if you already spent some time playing with different linear regressions, maybe you can come up with somehting. the 2 indicators you suggested are very similar to what i need i just cannot get them to pop up from BBs. thanks for your help.

Erman Ardianto
1141
Erman Ardianto  

well, sorry I have no idea how to help you right now.

To add comments, please log in or register