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

[amibroker] Re: Radians to Degrees ...Was ( linear regression slope)



PureBytes Links

Trading Reference Links





//Radians to Degrees
//Anthony Faragasso
//June 13,2003
ema1period=Param<FONT 
size=2>("ema1Period"<FONT 
size=2>,4<FONT 
size=2>,4<FONT 
size=2>,9<FONT 
size=2>,1);
EMA2period=Param<FONT 
size=2>("ema2Period"<FONT 
size=2>,9<FONT 
size=2>,9<FONT 
size=2>,20<FONT 
size=2>,1);
EMA3period=Param<FONT 
size=2>("ema3Period"<FONT 
size=2>,20<FONT 
size=2>,20<FONT 
size=2>,28<FONT 
size=2>,1);
SlopePeriods=Param<FONT 
size=2>("SlopePeriods"<FONT 
size=2>,10<FONT 
size=2>,2<FONT 
size=2>,25<FONT 
size=2>,1);
PI=3.14159;
Array=C;
Var1=EMA<FONT 
size=2>(array,EMA1period);
Var2=EMA<FONT 
size=2>(array,EMA2period);
Var3=EMA<FONT 
size=2>(array,EMA3period);
EMAFast=LinRegSlope<FONT 
size=2>(Var1,SlopePeriods);
EMAMedium=LinRegSlope<FONT 
size=2>(Var2,SlopePeriods);
EMASlow=LinRegSlope<FONT 
size=2>(Var3,SlopePeriods);
Radians=atan<FONT 
size=2>(EMAFast);//radians<FONT 
size=2>
Radians2=atan<FONT 
size=2>(EMAMedium);
Radians3=atan<FONT 
size=2>(EMASlow);
degrees=Radians*(180<FONT 
size=2>/PI);//Degrees
degrees2=Radians2*(180<FONT 
size=2>/PI);
degrees3=Radians3*(180<FONT 
size=2>/PI);
 
Plot(Var1,<FONT color=#ff00ff 
size=2>"emaFast",colorRed,styleLine);<FONT 
color=#0000ff size=2>
Plot(Var2,<FONT color=#ff00ff 
size=2>"emaMedium",colorBlue,styleLine);<FONT 
color=#0000ff size=2>
Plot(Var3,<FONT color=#ff00ff 
size=2>"emaSlow",colorYellow,styleLine);<FONT 
color=#0000ff size=2>
Plot(C,<FONT color=#ff00ff 
size=2>"",colorBlack,styleLine);
Title=Name<FONT 
size=2>()+"..."<FONT 
size=2>+Date<FONT 
size=2>()+"\n"<FONT 
size=2>+"Based on ( "<FONT 
size=2>+WriteVal<FONT 
size=2>(slopeperiods,1<FONT 
size=2>)+" ) period LinearRegSlope of 
Variable "+<FONT color=#ff00ff 
size=2>"\n"+"The ( 
"+WriteVal<FONT 
size=2>(EMA1period,1<FONT 
size=2>)+ " ) period EMA is moving 
"+WriteIf<FONT 
size=2>(degrees > 0<FONT 
size=2>,"UP "<FONT 
size=2>,"Down "<FONT 
size=2>)+"( "<FONT 
size=2>+WriteVal<FONT 
size=2>(degrees,1<FONT 
size=2>)+" )"<FONT 
size=2>+" Degrees"<FONT 
size=2>+"\n"<FONT 
size=2>+"The ( "<FONT 
size=2>+WriteVal<FONT 
size=2>(EMA2period,1<FONT 
size=2>)+ " ) period EMA is moving 
"+WriteIf<FONT 
size=2>(degrees2 > 0<FONT 
size=2>,"UP "<FONT 
size=2>,"Down "<FONT 
size=2>)+"( "<FONT 
size=2>+WriteVal<FONT 
size=2>(degrees2,1<FONT 
size=2>)+" )"<FONT 
size=2>+" Degrees"<FONT 
size=2>+"\n"<FONT 
size=2>+"The ( "<FONT 
size=2>+WriteVal<FONT 
size=2>(EMA3period,1<FONT 
size=2>)+ " ) period EMA is moving 
"+WriteIf<FONT 
size=2>(degrees3 > 0<FONT 
size=2>,"UP "<FONT 
size=2>,"Down "<FONT 
size=2>)+"( "<FONT 
size=2>+WriteVal<FONT 
size=2>(degrees3,1<FONT 
size=2>)+" )" 
+" Degrees"<FONT 
size=2>;
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Glenn 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Thursday, June 12, 2003 6:44 
  PM
  Subject: [amibroker] Re: linear 
  regression slope
  Jayson,Thanks for your help, would you know how to 
  convert this to degrees?Cheers Glenn--- In <A 
  href="">amibroker@xxxxxxxxxxxxxxx, 
  "Jayson" <jcasavant@x...> 
  wrote:> Glenn,> linregslope is different from linreg, it is in 
  fact the slope calculation of> the linear regression line.... from 
  help> >       
  LINREGSLOPE>       - linear regression 
  slope Statistical functions>       (AFL 
  1.4)> > >       
  SYNTAX  linregslope( ARRAY, periods 
  )>       RETURNS 
  ARRAY>       FUNCTION  Calculates 
  linear regression line slope from the ARRAY using> periods 
  range.>       EXAMPLE x = 
  Cum(1);>       lastx = LastValue( x ); 
  Daysback = 10; aa => astValue( LinRegIntercept( Close, Daysback) 
  );>       bb = LastValue( LinRegSlope( 
  Close, Daysback ) );> >       y = 
  Aa + bb * ( x - (Lastx - DaysBack) ); Plot( Close, "Close",> 
  colorBlack, styleCandle );>       Plot( 
  IIf( x >= (lastx - Daysback), y, -1e10 ), "LinReg", colorRed );> 
  > > > Regards,> Jayson> -----Original 
  Message-----> From: Glenn [mailto:glennokb@xxxx]> Sent: 
  Wednesday, June 11, 2003 7:38 AM> To: amibroker@xxxxxxxxxxxxxxx> 
  Subject: [amibroker] Re: linear regression slope> > > 
  Hi,> > Could someone please tell me what the result is from 
  linregslope> ie: how it is calculated.> > 
  Plot(LinRegSlope( C, 20 ),"LinReg",colorBlue,1);> 
  Plot(0,"0",colorRed,1);> > Thanks Glenn> > --- In 
  amibroker@xxxxxxxxxxxxxxx, Marek Chlopek <mchlopek@xxxx>> 
  wrote:> > On Saturday 31 May 2003 18:09, mleonsprint wrote:> 
  > > Does anyone have a formula for linear regression slope they 
  would> be> > > willing to share?> >> 
  > LINREGSLOPE> > - linear regression slope Statistical 
  functions> > (AFL 1.4)> >> >> > 
  SYNTAX  linregslope( ARRAY, periods )> > RETURNS ARRAY> 
  > FUNCTION  Calculates linear regression line slope from the 
  ARRAY> using periods> > range.> > EXAMPLE x = 
  Cum(1);> > lastx = LastValue( x ); Daysback = 10; aa => 
  tValue( > LinRegIntercept( Close, > > Daysback) );> 
  > bb = LastValue( LinRegSlope( Close, Daysback ) );> > > 
  > y = Aa + bb * ( x - (Lastx - DaysBack) ); Plot( Close, "Close", > 
  colorBlack, > > styleCandle );> > Plot( IIf( x >= 
  (lastx - Daysback), y, -1e10 ), "LinReg", colorRed );> >  
  > > SEE ALSO > >  > > > > -- 
  > > Marek Chlopek> > 
  >       Yahoo! Groups Sponsor 
  >      >      
  > > Send BUG REPORTS to bugs@xxxx> Send SUGGESTIONS to 
  suggest@xxxx> -----------------------------------------> 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 Yahoo! Terms of 
  Service.
  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.489 
  / Virus Database: 288 - Release Date: 
6/10/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.