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

Re: [amibroker] Re: Trendline with Degree output



PureBytes Links

Trading Reference Links




Glen,
 
Amibroker has linear regression slope as a 
built-in:
 
add this to the bottom of the  formula you 
just posted....
 

Plot(<FONT color=#0000ff 
size=2>LinRegSlope(C,<FONT color=#ff00ff 
size=2>21),<FONT color=#ff00ff 
size=2>"",colorRed,styleLine|styleOwnScale);<FONT 
face="Courier New" size=2> 
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Glenn 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Friday, June 20, 2003 7:46 PM
  Subject: [amibroker] Re: Trendline with 
  Degree output
  Hi,Regarding the linear regression slope.A 
  Metastock indicator (by Jose) posted and discussed here:<A 
  href="">http://www.stockcentral.com.au/forum/machine/Forum32/HTML/000864.htmlHere 
  is an attempt at a conversion to AB.Title = "Linear Regression Slope - 
  % 21";GraphXSpace = 5;pds= Param("LRS periods",21,1,150,1);x= 
  Param("Op=1 Hi=2 Lo=3 Cl=4 Vol=5",4,1,5,1);x= 
  IIf(x==1,O,IIf(x==2,H,IIf(x==3,L,IIf(x==4,C,V))));LRend= 
  LinearReg(x,pds);LRstart= LRend-LinRegSlope(x,pds)*(pds-1);y= 
  Min(LRend,LRstart)/Max(LRend,LRstart);LRS= 
  (IIf(LRend>LRstart,2-y,y)-1)/(pds-1)*100;pi= 4*atan(1);LRSper= 
  atan(LRS)*(180/pi)*10/9;Plot(LRSper,"LinReg",colorBlue,1);Plot(0,"",colorRed,1);Cheers 
  Glenn--- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" 
  <ajf1111@xxxx> wrote:> Mark,> > Yes, I have 
  read your previous posts.....I have been working on an update to the 
  formula **Trendline with degree output**, and from reading your most 
  recent post...it would seem  that I am going in the same 
  direction.....would you call it **Normalizing the close** ? > > 
  Anthony>   ----- Original Message ----- >   
  From: MarkF2 >   To: amibroker@xxxxxxxxxxxxxxx 
  >   Sent: Friday, June 20, 2003 12:04 PM>   
  Subject: [amibroker] Re: Trendline with Degree output> > 
  >   Anthony- Did you see my response to DT's post?  This 
  is not a matter>   of opinion, the formula is being 
  misapplied.  > >   Mark> 
  >   --- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" 
  <ajf1111@xxxx>>   wrote:>   > I 
  would like to thank Dimitri for lending a second pair of>   
  eyes....and checking over the formula for Trendline with 
  Degree>   output.....>   > 
  >   > Anthony>   >   ----- 
  Original Message ----- >   >   From: DIMITRIS 
  TSOKAKIS >   >   To: amibroker@xxxxxxxxxxxxxxx 
  >   >   Sent: Thursday, June 19, 2003 4:19 
  AM>   >   Subject: [amibroker] Re: Trendline 
  with Degree output>   > >   > 
  >   >   The angle of QQQ *is* 4deg, the angle of 
  ^NDX *is* 72deg and the >   >   formula *is* 
  correct.>   >   See also #3825 
  message.>   >   DT>   
  >   --- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" 
  <ajf1111@xxxx> >   >   
  wrote:>   >   > Thanks Mark.....I am looking 
  into it.....>   >   > >   
  >   > Anthony>   >   
  >   ----- Original Message ----- >   
  >   >   From: MarkF2 >   
  >   >   To: amibroker@xxxxxxxxxxxxxxx 
  >   >   >   Sent: Tuesday, June 17, 
  2003 3:20 PM>   >   >   Subject: 
  [amibroker] Re: Trendline with Degree output>   
  >   > >   >   > 
  >   >   >   Anthony- really nice, 
  but I think there's a bug somewhere.  >   
  >   Comparing>   >   
  >   QQQ with NDX, I got slopes of 4 and 72 degrees respectively, 
  even>   >   >   though both 
  trendlines were 27 days and the slopes looked the >   
  >   same.>   >   > 
  >   >   >   
  Mark>   >   > >   
  >   >   --- In amibroker@xxxxxxxxxxxxxxx, "Anthony 
  Faragasso" >   >   
  <ajf1111@xxxx>>   >   >   
  wrote:>   >   >   > //Automatic 
  Support Trendline With Degrees>   >   
  >   > >   >   >   
  > //Anthony Faragasso, 2003>   >   
  >   > >   >   >   
  > x = Cum(1);>   >   >   > 
  >   >   >   > per 
  =Param("Percent",2,0.01,3,0.01);// Sensitivity setting>   
  >   >   > >   >   
  >   > s1=L;//Array>   >   
  >   > >   >   >   
  > EndValue1 = LastValue( Trough( s1, per, 1 ) );>   
  >   >   > >   >   
  >   > startvalue = LastValue( Trough( s1, per, 2 ) 
  );>   >   >   > 
  >   >   >   > endbar = 
  LastValue( ValueWhen( s1 == EndValue1, x, 1 ) );>   
  >   >   > >   >   
  >   > startbar = LastValue( ValueWhen( s1 == startvalue, x, 
  1 ) );>   >   >   > 
  >   >   >   > aS = 
  (EndValue1-startvalue)/(endbar-startbar);>   >   
  >   > >   >   >   
  > bS = EndValue1;>   >   >   
  > >   >   >   > trendline = 
  aS * ( x -endbar ) + bS;>   >   >   
  > >   >   >   > 
  //-----------------------------------//>   >   
  >   > >   >   >   
  > //      Conversion to 
  Degrees              
  //>   >   >   > 
  >   >   >   > 
  //-----------------------------------//>   >   
  >   > >   >   >   
  > pi=4*atan(1);>   >   >   > 
  >   >   >   > 
  time=endbar-startbar;>   >   >   
  > >   >   >   > 
  myslope=LinRegSlope(trendline,time);>   >   
  >   > >   >   >   
  > myradian=atan(myslope);>   >   
  >   > >   >   >   
  > mydegree=myradian*(180/PI);//Degrees>   >   
  >   > >   >   >   
  > //-------------------------------------//>   
  >   >   > >   >   
  >   > 
  Plot(C,"close",colorBlack,styleCandle);>   >   
  >   > >   >   >   
  >>   >   >   
  Plot(IIf(x>startbar-5,trendline,->   >   
  1e10),"Trendline",colorYellow,styleLine);>   >   
  >   > >   >   >   
  > direction=WriteIf(mydegree >= 0 AND mydegree <= 
  0.99,"Flat>   >   >   > 
  ",WriteIf(mydegree > 0 ,"Rising ",WriteIf(mydegree < 
  >   >   0 , "Falling ",>   
  >   >   "")));>   >   
  >   > >   >   >   
  > DirectionColor=LastValue(IIf(mydegree >>   
  >   >   0,colorBrightGreen,IIf(mydegree < 
  0,>   >   >   > 
  colorRed,IIf(mydegree >= 0 AND mydegree <= >   
  >   0.99 ,colorYellow,Null))));>   
  >   >   > >   >   
  >   > Title=Name()+"..."+Date()+"\n"+"TRENDLINE 
  is>   >   >   > 
  "+EncodeColor(directioncolor)+direction+EncodeColor(colorBlack)>   
  >   +"at>   >   >   
  "+"( "+>   >   >   > 
  WriteVal(mydegree,1)+" )"+" Degrees";>   >   
  >   > >   >   >   
  > >   >   >   > 
  >   >   >   > //plotting ( x, y 
  ) grid>   >   >   > 
  >   >   >   > 
  Plot(startbar==x,"",colorRed,styleHistogram|styleOwnScale);>   
  >   >   > >   >   
  >   > 
  Plot(ValueWhen(startbar==x,Low),"",colorRed,styleLine);>   
  >   >   > >   >   
  >   > 
  //-----------------------------------//>   >   
  >   > >   >   >   
  > // Automatic Anlaysis window Output //>   
  >   >   > >   >   
  >   > 
  //-----------------------------------//>   >   
  >   > >   >   >   
  > // Settings : //>   >   >   
  > >   >   >   > // n last 
  quotations and n=1 //>   >   >   
  > >   >   >   > // explore 
  //>   >   >   > 
  >   >   >   > 
  //-----------------------------------//>   >   
  >   > >   >   >   
  > Filter=mydegree > 0 OR mydegree <0;>   
  >   >   > >   >   
  >   > AddColumn(mydegree,"Degree",1);
  Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 
  
<BLOCKQUOTE 
><FONT 
  face="Courier New">---Outgoing mail is certified Virus 
  Free.Checked by AVG anti-virus system (<A 
  href="">http://www.grisoft.com).Version: 6.0.491 
  / Virus Database: 290 - Release Date: 
6/18/2003






Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



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