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

[EquisMetaStock Group] Re: Linear Regression / Linear Regression Slope Relationship



PureBytes Links

Trading Reference Links

Roy, maybe this will help:

=======================
Lin Reg Indicator/Slope
=======================
---8<---------------------------

{ User inputs }
plot:=Input("[1]LinReg Indicator,   [2]LinReg Slope)",1,2,1);
pds:=Input("LinReg periods)",2,2520,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))));

{ Linear Regression components }
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);

{ Linear Regression Slope }
z:=If(z=0,.000001,z);
LinRegSlp:=y/z;

{Linear Regression Indicator (LinReg end-point)}
LinRegInd:=LinRegSlp*Cum(1)
 -LinRegSlp*Mov(Cum(1),pds,S)+Mov(x,pds,S);

{ Plot }
If(plot=1,LinRegInd,LinRegSlp)

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


jose '-)


--- In equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx> 
wrote:
> Hi All
> 
> Can anyone help with the mathematical relationship between Linear 
Regression and Linear Regression
> Slope. I have found that the formula created by Tom (Sprunger) for 
Linear Regression, using a pseudo
> loop, to be more true to the standard Linear Regression indicator in 
MetaStock than the common LR
> formula using a number of Cum() functions. I would like to carry 
that greater accuracy through to a
> Linear Regression Slope indicator for plotting the weekly value on 
daily charts.
> 
> Any assistance would be appreciated.
> 
> Thanks
> 
> Roy



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> 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/