Linear Regression Indicator

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]

Link :=

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);


// initial checkings

If RPeriod < 1 Then Exit;


loopbegin = 206-length-1;

For shift = loopbegin Downto 0 Begin


For i = length downTo 1 Begin

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





Thank you

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.

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

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?