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

[Metastockusers] Re: need accurate Linear Regression code



PureBytes Links

Trading Reference Links

Thanks Corey,

> I still have MS 7.2 on my machine and both remain a perfect match to 
the built-in indicators at periods=2.

So in MS v7.2, the code below plots an exact replica of the price?
Or are you using different code?
 

Linear Regression Indicator formula
===================================

---8<------------------------------

pds:=Input("LinReg periods)",2,2520,2);
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<------------------------------


Thanks,
jose '-)




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Save on Coral Calcium. Get Better Health and
Stronger Bones. Seen on TV
http://www.challengerone.com/t/l.asp?cid-2805&lp=calcium2.asp
http://us.click.yahoo.com/9gf46B/EfUGAA/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/