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

[Metastockusers] Re: Jose's Linear Regression Slope Indicator



PureBytes Links

Trading Reference Links


Alex, that LRS indicator uses a "P" function - it forces The Explorer 
to prompt for a plot to apply the code to.
Try using this code in ColA:


MetaStock -> Tools -> The Explorer -> New
Copy and paste formula below.

============================
Linear Regression true slope
============================
---8<---------------------------

{ Linear Regression true Slope v3.5 }
{ -100~+100% / -90~+90 degrees }
{ ©Copyright 2003-2004 Jose Silva }
{ http://users.bigpond.com/prominex/pegasus.htm  }

pds:=21;  {Linear Regression periods}
pds1:=5;  {Lin Reg Signal periods}
x:=4;     {Open=1, High=2, Low=3, Close=4, Volume=5}
display:=1; {display  -100~100%=1,  -90~90 degrees=2}
plot:=1;  {[1] LinReg Slope,  [2] signals}

x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,C))));
LRlast:=LinearReg(x,pds);
LRS:=LinRegSlope(x,pds);
LRprev:=LRlast-LRS;
{LRstart:=Ref(LRlast-LRS*(pds-1),pds-1);}

a:=Min(LRlast,LRprev)/Max(LRlast,LRprev);
LRratio:=(If(LRlast>LRprev,2-a,a)-1)*80;
LRSdeg:=If(LRratio<0,Atan(LRratio,1)-360,
 Atan(LRratio,1));
LRSper:=LRSdeg*10/9;
LRStrue:=If(display=2,LRSdeg,LRSper);
signal:=Mov(LRStrue,pds1,E);
BuySell:=
 Cross(LRStrue,signal)-Cross(signal,LRStrue);

{If(plot=1,LRStrue,BuySell)}
LRSdeg

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


jose '-)



--- In Metastockusers@xxxxxxxxxxxxxxx, "alui_98" <alui_98@xxxx> wrote:
> 
> I downloaded the Linear Regression Slope Indicator from his site and
> tried to use it as follows in the MS explorer:
> 
> Column A:   a:=FmlVar("LRS", "LRSDEG");  {display the degree}
>             a;
> 
> I ran the above on a single stock just to test but got the following
> error in the resulting report (under the Rejects tab):
> 
> Error in column A: Requires a selected price or indicator plot in
> the active chart.
> 
> Does anyone know what this error means?  Jose, if you read this,
> perhaps you'd like to tell me exactly how I can extract the "LRSDEG"
> component from your indicator in an explorer.
> 
> Thanks in advance,
> -Alex





------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/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/