[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Code for End Points of Linear Regression



PureBytes Links

Trading Reference Links

Keith,

Here is the converted formula that I had been using, But.....you can now
use the built-in function in Amibroker ( I am using version 4.20.1 beta
) but it was introduced a few beta's ago.

Plot(close,"Close",colorBlue,Stylecandle);
Plot(LinearReg(C,14),"LinearReg",colorYellow,styleLine);

And Here is the converted formula:

/***************Start****************/
datarray=C ;
periods=14;
LinearReg1=(periods * Sum(Cum(1) * datarray,periods) - Sum(Cum
(1),periods)* Sum(datarray,periods)) / (periods *
Sum((Cum(1)^2),periods) - (Sum(Cum(1),periods)^2)) * Cum(1) +
(MA(datarray,periods) - MA(Cum(1),periods) * (periods * Sum(Cum(1) *
datarray,periods) - Sum(Cum(1),periods) * Sum(datarray,periods)) /
(periods * Sum((Cum(1)^2),periods) - Sum(Cum(1),periods)^2));

Plot(C,"close",6,64);
Plot(LinearReg1,"linReg",4,1);

/**************End******************/

Anthony

Keith Newhouse wrote:

> Hi Group,
>
> Cany anyone help me with the AFL code for this Metastock End of
> Points of Linear Regression indicator, please.
>
> Regards,
> Keith
>
> *Linear Regression (14):
> (14 * Sum(Cum(1) * C,14) - Sum(Cum(1),14)* Sum(C,14)) /(14 * Sum(Pwr
> (Cum(1),2),14) - Pwr(Sum(Cum(1),14),2)) * Cum(1) + (Mov(C,14,S) - Mov
> (Cum(1),14,S) * (14 * Sum(Cum(1) * C,14) - Sum(Cum(1),14) * Sum
> (C,14))/(14 * Sum(Pwr(Cum(1),2),14) - Pwr(Sum(Cum(1),14),2)))
>
>
> Yahoo! Groups Sponsor
ADVERTISEMENT


>
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.