Linear regression channel

 

can someone translate this tradestation script to mt4 and make it a envelope that adjust itself to highs and lows?

{*******************************************************************

Description : This Indicator plots Linear Regression

Provided By : Omega Research, Inc. (c) Copyright 1999

********************************************************************}

Inputs: Price(Close), Length(14), Displace(0);

If Displace >= 0 OR CurrentBar > AbsValue(Displace) Then Begin

Plot1[Displace](LinearRegValueFC(Price, Length, 0), "LinearReg");

{Alert Criteria}

If Price < Plot1 AND Plot1 Plot1[2] Then

Alert("The Linear Regression has just changed direction and is now bullish")

Else

If Price > Plot1 AND Plot1 > Plot1[1] AND Plot1[1] < Plot1[2] Then

Alert("The Linear Regression has just changed direction and is now bearish");

{Linear Regression Expert Commentary}

#BeginCmtry

Commentary(ExpertLinearReg(Length, Plot1));

#End;

End;

 

actually i am not talking about a channel with 2 straight lines. i am talking about curved lines like a moving average envelope.

 

Hi,

perhaps you can find something here https://www.mql5.com/en/forum/174318

 

NB channel indicator


Files:
Reason: