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

[Metastockusers] Re: need accurate Linear Regression code



PureBytes Links

Trading Reference Links

The more data you have in your linear regression, the more accurate 
it is able to draw the slope and therefore the more accurate the 
slope is at determining the rate of change. The formula I sent is 
correct. You have to make sure you've got the right values for all of 
your variables. Metastock's formula only allows you to change the 
periods. The rest is automatic to prevent this problem.

Good luck.



--- In Metastockusers@xxxxxxxxxxxxxxx, "Jose" <josesilva22@xxxx> 
wrote:
> 
> Ok, I've fixed the 2-period LinReg issue, but now there are 
> discrepancies with the MetaStock LinReg Indicator, noticeable at 
> shorter periods.
> 
> It seems to me that my version is the correct one.
> 
> Feedback, please?
> 
> j '-)
> 
> 
> LinReg Indicator/Slope formula
> ==============================
>  
> ---8<-------------------------
> 
> {©Copyright 2003 Jose Silva}
> {josesilva22@xxxx}
> 
> pds:=Input("LinReg periods)",2,2520,5)-1;
> plot:=Input("plot: Indicator=1, Slope=2",1,2,1);
> x:=Input("use Open=1, High=2, Low=3, Close=4, Volume=5",1,5,4);
> x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=4,C,V))));
> 
> y:=pds*Sum(Cum(1)*x,pds)
>  -Sum(Cum(1),pds)*Sum(x,pds);
> z:=pds*Sum(Pwr(Cum(1),2),pds)
>  -Pwr(Sum(Cum(1),pds),2);
> z:=If(z=0,.000001,z);
> 
> LRS:=y/z;
> LR:=
> LRS*Cum(1)-LRS*Mov(Cum(1),pds,S)+Mov(x,pds,S);
> 
> If(plot=1,LR,0);
> If(plot=1,LR,LRS)
> 
> ---8<-------------------------


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Save up to 80% on top-quality inkjet cartridges and get your order fast!
FREE shipping on orders $50 or more to the US & Canada. Shop at Myinks.com!
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/v2G7ND/KfUGAA/ySSFAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/