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

[Metastockusers] Re: need accurate Linear Regression code



PureBytes Links

Trading Reference Links

--- In Metastockusers@xxxxxxxxxxxxxxx, "kelols" <kelols@xxxx> wrote:

> (2 * Sum(Cum(1) * C,2) - Sum(Cum(1),2)* Sum(C,2)) / 
> (2 * Sum(Pwr(Cum(1),2),2) - Pwr(Sum(Cum(1),10),2)) * 
> Cum(1) + (Mov(C,2,S) - Mov(Cum(1),2,S) * 
> (2 * Sum(Cum(1) * C,2) - Sum(Cum(1),14) * Sum(C,2)) / 
> (2 * Sum(Pwr(Cum(1),2),2) - Pwr(Sum(Cum(1),10),2)))


Unfortunately the above doesn't plot an identical plot to the price, 
even when adjusting all 10-period code to 2:

---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))));

(pds*Sum(Cum(1)*x,pds) - Sum(Cum(1),pds)* Sum(x,pds)) /
(pds*Sum(Pwr(Cum(1),2),pds) - Pwr(Sum(Cum(1),pds),2)) *
Cum(1)+(Mov(x,pds,S)-Mov(Cum(1),pds,S) *
(pds*Sum(Cum(1)*x,pds) - Sum(Cum(1),14)*Sum(x,pds)) /
(pds*Sum(Pwr(Cum(1),2),pds) - Pwr(Sum(Cum(1),pds),2)))

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


The 2-period LinReg Indicator plot should be identical to the price 
plot.

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/