PureBytes Links
Trading Reference Links
|
Tom
An excellent solution.
Jose
Space is a bigger problem than the 40 constant limitation. Sorry about messing up your comments but
I needed the room to get to 50.
Roy
{Example of MetaStock pseudo-loop code,
MetaStock Linear Regression Indicator
Tom Sprunger 2004}
pds:=Input("Lin Reg periods",1,50,21);
y:=Input("use O=1 H=2 L=3 C=4 WC=5 P=6",1,6,4);
y:=If(y=1,O,If(y=2,H,If(y=3,L,If(y=5,WC(),If(y=6,P,C)))));
k1:=(pds+1)/3;
{Start pseudo loop}
x:=(pds-k1)*y;
n:=pds-1;x:=If(n>0,x+(n-k1)*Ref(y,-1),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-2),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-3),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-4),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-5),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-6),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-7),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-8),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-9),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-10),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-11),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-12),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-13),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-14),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-15),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-16),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-17),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-18),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-19),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-20),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-21),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-22),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-23),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-24),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-25),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-26),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-27),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-28),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-29),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-30),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-30-1),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-30-2),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-30-3),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-30-4),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-30-5),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-30-6),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-30-7),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-30-8),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-30-9),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-40),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-40-1),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-40-2),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-40-3),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-40-4),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-40-5),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-40-6),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-40-7),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-40-8),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-40-9),x);
n:=n-1;x:=If(n>0,x+(n-k1)*Ref(y,-50),x);
{End pseudo loop}
k2:=6/(pds*(pds+1));
wt:=x*k2;wt;
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/zMEolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Metastockusers/
<*> To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|