| 
 Try  
  
Angle = 
Atan((LR_Line-Ref(LR_Line,-1))/x-Ref(x,-1)); 
  
where the prior point is the origin of your grid. 
The answer may be in radians. Check help 
  ----- Original Message -----  
  
  
  Sent: Wednesday, July 20, 2005 3:44 
  PM 
  Subject: RE: [amibroker] Some Math Help 
  Please 
  
  
  Graham, 
    
  I am trying 
  to determine the angle of the Linereg and Ema lines at a particular point in 
  time. For instance, if you draw a 90 degree horizontal and vertical line and 
  the Linereg comes through the intersection of that 90 degree, what angle is 
  the linereg relative to the 90 degree base. If I could include an image I 
  could probably express it a little better. 
    
  | 
  | 
  | 
  | 
  |    / 
  |  
  /  need the angle of this. 
  |/_____________________ 
    
  Thank 
  you 
  Tom 
    
    
    
    
    
    
  In what way are you getting wrong 
  numbers? Are you wanting the angle of the linreg line?
  The results 
  look ok to me after plotting.  
  You have to remember that slope is 
  an arbitrary number in charts. You must calculate it to suit the scaling 
  factors that affect it if you want to gtet the answer similar to what you 
  see on the screen. The screen drawn angle will change as you zoom in/out of 
  the chart and may possibly be the same as calculated figure if yuo get 
  lucky. I have stated this before some time ago, angle means 
  absolutely nothing by itself as you have no reference in which to base 
  it.
 
 
 
  On 7/21/05, mymail <grpmail@xxxxxxxxxxxxxxxx> 
  wrote: > Graham, >   > I read the thread as it went on. 
  Unfortunately, I am doing something wrong, > as I am not getting the 
  correct numbers. >   > Here is my code snippet. Did I miss 
  something obvious? >   >  >  > LSMA = 
  LinearReg(C, 25 );  >  > EMA34 = EMA(C,34);  >  > 
  a=atan(LinRegSlope(LSMA,3));  >  > b=atan(LinRegSlope(EMA34,3)); 
   >  > RAD_TO_DEG = 180/3.1415926; // radians to degrees  > 
   > Angle = RAD_TO_DEG * a;  >  > Angle1 = RAD_TO_DEG * b; 
   >  > "LSMA ANGLE IS: "+ WriteVal(Angle);  >  > "EMA34 
  ANGLE IS: "+ WriteVal(Angle1); >   > -----Original 
  Message----- > From: amibroker@xxxxxxxxxxxxxxx 
  [mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf > Of Graham > Sent: 
  Wednesday, July 20, 2005 5:44 PM > To: amibroker@xxxxxxxxxxxxxxx > 
  Subject: Re: [amibroker] Some Math Help Please >  > just had that 
  discussion here this week re slopes calculation >  > slope = 
  (value2 - value1) / (bar2 - bar1); > angle_rad = 
  atan(slope);//radians > angle_deg = angle_rad * 
  180/3.1416;//degrees >  > On 7/21/05, mymail 
  <grpmail@xxxxxxxxxxxxxxxx> wrote: > > Thank you Joe, good 
  advice. Unfortunately, I was trying to get Math help > > rather than 
  AFL help. It has been so long that I studied Trig that I > 
  forgot > > how to calculate the angle of a line. > > So for 
  instance, how would I calculate the angle in degrees of a line such > 
  > as a moving average? > >   > > thank you > 
  > Tom > >   > > -----Original Message----- > 
  > From: amibroker@xxxxxxxxxxxxxxx 
  [mailto:amibroker@xxxxxxxxxxxxxxx]On > Behalf > > Of Joe 
  Landry > > Sent: Monday, July 18, 2005 8:27 AM > > To: 
  amibroker@xxxxxxxxxxxxxxx > > Subject: Re: [amibroker] Some Math Help 
  Please > >  > >  > >  > > AN EXAMPLE: 
   > >  > > I don't know why your codes doesn't work but 
  building on what Graham wrote > > here's a an example (since I had to 
  fight through this at one time) > >  > > This is a snippet 
  from one of my indicators is based on Dimitris's work > > ....BB is 
  the slope of the line at the last bar.  I write it out on the > 
  > chart > >  > > as follows  > >  > > 
  Title= FullName()+" "+ Date()+"\n"+ "Slope of Regression Line(X1000) = 
  "+ > > WriteVal(10000*bb);  > >  > > If  
  you're new to this script, I'd recommend you take up one of the most > 
  > productive practices I've found and > >  > > adapt for 
  your work.  Find an information database(I use Infoselect)  
  for > > your system and clip every interesting indicator or algorithm 
  you  > >  > > see used in this forum for your own 
  library.  This of course would be in > > addition to what Graham 
  recommended 2-3 weeks back...going through each > > function and 
  using the function in a test program . > >  > > Searching 
  the archives 2-3 years back for Graham's and Dimitris Tsokakis' > > 
  work would also pay off.  > >  > > Best regards > > 
   > > JOE  > >  > >   > >  > 
  >   > >  > > // Plot the slope of the relative 
  strength line > >  > > //  > >  > > 
  Daysback = 126; // 6 months  > >  > > x = Cum(1); // the X 
  axis, abscissa > >  > > LastX = LastValue(X);  > > 
   > > C1 = Issue2Rel; // the Y axis, the ordinate > > 
   > > aa = LastValue( LinRegIntercept( C1, Daysback) ); > > 
   > > bb = LastValue( LinRegSlope( C1, Daysback ) ); > > 
   > > yy = Aa + bb * ( x - (Lastx - DaysBack) ); // the algebraic 
  equation for a > > straight line > >  > > yy=IIf( x 
  >= (lastx - Daysback), yy, -1e10 ); // roll the plot forward and > 
  > show only the 6 months > >  > > Plot( yy, 
  "LinRegression Line", colorDarkRed,styleThick);  > >  > > 
  UpperSEBand = YY + 2*StdErr(Issue2Rel,126);  > >  > > 
  LowerSEBand = YY - 2*StdErr(Issue2Rel,126);  > >  > > 
  Plot(UpperSEBand,"Upper 2 Sigma",colorBlue,styleLine);  > >  > 
  > Plot(LowerSEband,"Lower 2 Sigma",colorBlue,styleLine);  > > 
  ----- Original Message -----  > > From: valrox1  > > To: 
  amibroker@xxxxxxxxxxxxxxx  > > Sent: Monday, July 18, 2005 12:36 
  AM > > Subject: [amibroker] Some Math Help Please > > 
   > > I am trying to calculate the angle of a plotted slope in 
  degrees.  > > Below is the code I thought would work, but 
  doesn't. > >  > > Any thoughts? > >  > > 
  Thank you > > Tom > >  > > LSMA = LinearReg(C, 25 
  );  > >  > > a=atan(LSMA); > >  > > 
  RAD_TO_DEG = 180/3.1415926; // radians to degrees > >  > > 
  Angle = RAD_TO_DEG * a; //  > >  > > Plot( Angle, "LSMA", 
  colorYellow, styleThick);  > >  > >  > > Title = 
  "Angle=" + Angle +      EncodeColor(colorWhite) + " " 
  + Date > > (); > >  > >  > >  > > 
   > >  > >  > > Please note that this group is for 
  discussion between users only. > >  > > To get support from 
  AmiBroker please send an e-mail directly to  > > SUPPORT {at} 
  amibroker.com > >  > > For other support material please 
  check also: > > http://www.amibroker.com/support.html > 
  >  > >  > >  > >  > >  > > 
  SPONSORED LINKS  > > Investment management software Investment 
  property software Investment > > software  > > Investment 
  tracking software Return on investment software Stock > 
  investment > > software  > > 
  ________________________________ > > YAHOO! GROUPS LINKS  > 
  >  > >  Visit your group "amibroker" on the web. > 
  >    > >  To unsubscribe from this group, send an 
  email to: > >  amibroker-unsubscribe@xxxxxxxxxxxxxxx > 
  >    > >  Your use of Yahoo! Groups is subject to 
  the Yahoo! Terms of Service.  > >  To unsubscribe from this 
  group, send an email to: > >  
  amibroker-unsubscribe@xxxxxxxxxxxxxxx > >    > 
  >  Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
  Service.  > >  Your use of Yahoo! Groups is subject to the 
  Yahoo! Terms of Service.  > > 
  ________________________________ > >  >  >  > -- 
   > Cheers > Graham > http://e-wire.net.au/~eb_kavan/ > 
   >  > Please note that this group is for discussion between users 
  only. >  > To get support from AmiBroker please send an e-mail 
  directly to  > SUPPORT {at} amibroker.com >  > For other 
  support material please check also: > http://www.amibroker.com/support.html > 
   >  >  >  > ________________________________ > 
  YAHOO! GROUPS LINKS  >  >  Visit your group "amibroker" on 
  the web. >    >  To unsubscribe from this group, 
  send an email to: >  
  amibroker-unsubscribe@xxxxxxxxxxxxxxx >    >  Your 
  use of Yahoo! Groups is subject to the Yahoo! Terms of Service.  >  
  To unsubscribe from this group, send an email to: >  
  amibroker-unsubscribe@xxxxxxxxxxxxxxx >    >  Your 
  use of Yahoo! Groups is subject to the Yahoo! Terms of Service.  >  
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.  > 
  ________________________________ > 
 
  -- 
   Cheers Graham http://e-wire.net.au/~eb_kavan/ 
  
Please note that this group is for discussion between users only. 
 
To get support from AmiBroker please send an e-mail directly to  
SUPPORT {at} amibroker.com 
 
For other support material please check also: 
http://www.amibroker.com/support.html 
 
  
    
  
  
  
    SPONSORED LINKS
   
       
  
 
  
    
  YAHOO! GROUPS LINKS
 
 
    
  |