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

[EquisMetaStock Group] LinReg Trendline & Std Dev Channels



PureBytes Links

Trading Reference Links

Linear Regression Trendline
with Standard Deviation Channels,
date-adjustable.

jose '-)


===========================
Linear Regression Trendline
===========================
---8<---------------------------

{ Linear Regression Trendline Channel v2.0 }
{ ©Copyright 2004 Jose Silva }
{ http://users.bigpond.com/prominex/pegasus.htm }

EnDay:=Input("end Day",1,31,31);
EnMnth:=Input("end Month",1,12,12);
EnYear:=Input("end Year",1800,2200,2006);
pds:=Input("Linear Regression Trendline periods",2,2520,63);
multi:=Input("Channel Standard Deviations",
 0,100,2);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));

end:=Year()>EnYear
 OR (Year()=EnYear AND (Month()>EnMnth
  OR Month()=EnMnth AND DayOfMonth()>=EnDay));
end:=end AND Alert(end=0,2);
end:=If(LastValue(Cum(Ref(end,pds)))=0,
 LastValue(Cum(1))=Cum(1),end);

lastValLRI:=LastValue(Highest(
 If(end,LinearReg(x,pds),0)));
lastValLRS:=LastValue(Highest(
 If(end,LinRegSlope(x,pds),-10000)));

adjust:=LastValue(LastValue(Cum(1))
 -Highest(If(end,Cum(1),0)));
countback:=LastValue(Cum(1))-Cum(1)-adjust;
{ rem next line to extend plot to end of chart }
countback:=Ref(Ref(countback,-adjust),adjust);

LR:=lastValLRI-lastValLRS*countback;
restrict:=0-(LastValue(Cum(1))-pds)+adjust;
LRT:=Ref(Ref(LR,-restrict),restrict);
upLR:=LRT+Stdev(LR,pds)*multi;
lwLR:=LRT-Stdev(LR,pds)*multi;
 
upLR;lwLR;LRT

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






------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/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/