PureBytes Links
Trading Reference Links
|
Hi Jose,
I still have MS 7.2 on my machine and both remain
a perfect match to the built-in indicators at periods=2.
-Corey
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Jose
To: <A
title=Metastockusers@xxxxxxxxxxxxxxx
href="">Metastockusers@xxxxxxxxxxxxxxx
Sent: Sunday, July 06, 2003 12:58
PM
Subject: [Metastockusers] need accurate
Linear Regression code
I need the Linear Regression Indicator & Linear
Regression Slope formulae.The code I've been using (from memory,
similar to Corey's code?) gives good matching plots with MS v8.01, until I
begin using shorter periods.Linear Regression Indicator
formula===================================---8<------------------------------pds:=Input("LinReg
periods)",2,2520,14);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);LR:=y/z*Cum(1)-y/z*Mov(Cum(1),pds,S)+Mov(x,pds,S);LR---8<------------------------------Linear
Regression Slope
formula===============================---8<------------------------------pds:=Input("LinRegSlope
periods",2,252,21);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);y/z---8<------------------------------Using
the code above with a 2-period LinReg should match the price plot exactly,
but it doesn't.Anyone help, please?jose
'-)To
unsubscribe from this group, send an email
to:Metastockusers-unsubscribe@xxxxxxxxxxxYour use
of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|