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

Re: [amibroker] Re: Trendline with Degree output



PureBytes Links

Trading Reference Links




Perhaps the concept of degrees of slope for a 
price vs time chart needs to be considered.  The slope of the linear 
regression line, as derived from LinRegSlope, is expressed in terms of 
(change of price)/(change in time), or something like $/bar, $/day, etc.  
(A degree measurement, however, would be dimensionless, for example as 
determined by dividing one quantity, say some distance in meters, into 
another distance, which is also in meters).  Consequently, since 
LinRegSlope is not really in radians, converting it to degrees doesn't really do 
it, but just multiplies the $/bar result by a (dimensionless) number - ie., 
180/pi.   
Question: Why try to convert to degrees?  
Perhaps the $/bar slope is all that is needed?  Or maybe a ($/bar)/(avg 
price) to get a sort of % per bar change?
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  MarkF2 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Tuesday, June 17, 2003 12:20 
  PM
  Subject: [amibroker] Re: Trendline with 
  Degree output
  Anthony- really nice, but I think there's a bug 
  somewhere.  ComparingQQQ with NDX, I got slopes of 4 and 72 degrees 
  respectively, eventhough both trendlines were 27 days and the slopes 
  looked the same.Mark--- In <A 
  href="">amibroker@xxxxxxxxxxxxxxx, 
  "Anthony Faragasso" <<A 
  href="">ajf1111@x...>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);> > > > > 
  ---> Outgoing mail is certified Virus Free.> Checked by AVG 
  anti-virus system (<A 
  href="">http://www.grisoft.com).> Version: 
  6.0.489 / Virus Database: 288 - Release Date: 6/10/2003Send 
  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. 







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.