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

Re: [EquisMetaStock Group] Linear Regression Formula



PureBytes Links

Trading Reference Links

Hi Corey

(Repeated message - I don't think the first reply was posted)
Nice to see that you still check out this list from time to time.

> BTW, LinRegSlope is:
>
> T1:=Input("LinRegSlope periods",2,250,13);
>
((T1*(Sum(Cum(1)*C,T1)))-(Sum(Cum(1),T1)*(Sum(C,T1))))/((T1*Sum(Pwr(Cum(1),2
),T1))-Pwr(Sum(Cum(1),T1),2));

Thanks once again for the above formula. This is the one that I was looking
for but didn't realize it until you added it to your post. I can now
demonstrate what I was wanting to do, and in the following formulas I've
taken the liberty of reducing the code to manageable (for my brain) factors.
The first of the following formulas is just the above one rearranged. The
second formula allows a "what if" check of the LRS by substituting another
array value for the usual last data array value. In the example I am
substituting 'H' for 'C', but it could be anything.

This process is not a lot of use to most but I was hoping it might prove
useful when combined with my "price compensated LRS". Sadly that doesn't
seem to be the case with the limited checks I've done so far but I think the
exercise has still been worthwhile.

Regards

Roy

  {Linear Regression Slope}
D:=Input("Periods",2,250,13);
X:=C; {target array}
A:=Sum(Cum(1)*X,D);
B:=Sum(Cum(1),D);
F:=Sum(X,D);
G:=Sum(Pwr(Cum(1),2),D);
(D*A-B*F)/(D*G-Pwr(B,2));

  {Linear Regression Slope}
  {data array last value substitution}
D:=Input("Periods",2,250,13);
X:=C; {target array}
M:=H; {substitution}
A:=Sum(Ref(Cum(1)*X,-1),D-1)+Cum(1)*M;
B:=Sum(Cum(1),D);
F:=Sum(Ref(X,-1),D-1)+M;
G:=Sum(Pwr(Cum(1),2),D);
(D*A-B*F)/(D*G-Pwr(B,2));

-Corey Saxe
  ----- Original Message -----
  From: Roy Larsen
  To: equismetastock@xxxxxxxxxxxxxxx
  Sent: Thursday, February 20, 2003 2:16 PM
  Subject: [EquisMetaStock Group] Linear Regression Formula


  Hi All,

  Does anyone know the MetaStock formula (not the function syntax) for
Linear
  Regression. I'd like to rebuild it so that I can use my own composite data
  array. Alternatively I'd like to be able to create a data array that has a
  custom indicator value replacing one CLOSE. This replacement will always
  occur at the same relative position in the array (most recent bar), but
for
  backtesting purposes must be able to recalculate on every bar.

  Any thoughts would be very much appreciated.

  Roy



        Yahoo! Groups Sponsor
              ADVERTISEMENT




  To unsubscribe from this group, send an email to:
  equismetastock-unsubscribe@xxxxxxxxxxxxxxx



  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



------------------------ Yahoo! Groups Sponsor ---------------------~-->
New Yahoo! Mail Plus. More flexibility. More control. More power.
Get POP access, more storage, more filters, and more.
http://us.click.yahoo.com/Hcb0iA/P.iFAA/46VHAA/BefplB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx

 

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