PureBytes Links
Trading Reference Links
|
Try this in Indicator Builder:
ema1period=Param("ema1Period",4,4,9,1);
EMA2period=Param("ema2Period",9,9,20,1);
EMA3period=Param("ema3Period",20,20,28,1);
SlopePeriods=Param("SlopePeriods",10,2,25,1);
PI=3.14159;
Array=C;
Var1=EMA(array,EMA1period);
Var2=EMA(array,EMA2period);
Var3=EMA(array,EMA3period);
EMAFast=LinRegSlope(Var1,SlopePeriods);
EMAMedium=LinRegSlope(Var2,SlopePeriods);
EMASlow=LinRegSlope(Var3,SlopePeriods);
Radians=atan(EMAFast);//radians
Radians2=atan(EMAMedium);
Radians3=atan(EMASlow);
degrees=Radians*(180/PI);//Degrees
degrees2=Radians2*(180/PI);
degrees3=Radians3*(180/PI);
Plot(Var1,"emaFast",colorRed,styleLine);
Plot(Var2,"emaMedium",colorBlue,styleLine);
Plot(Var3,"emaSlow",colorYellow,styleLine);
Plot(C,"",colorBlack,styleBar);
Title=Name()+"..."+Date()+"\n"+"Based on ( "+WriteVal(slopeperiods,1)+" )
period LinearRegSlope of Variable "+"\n"+"The ( "+WriteVal(EMA1period,1)+
" ) period EMA is moving "+WriteIf(degrees > 0,"UP ","Down ")+"(
"+WriteVal(degrees,1)+" )"+" Degrees"+"\n"+"The ( "+WriteVal(EMA2period,1)+
" ) period EMA is moving "+WriteIf(degrees2 > 0,"UP ","Down ")+"(
"+WriteVal(degrees2,1)+" )"+" Degrees"+"\n"+"The ( "+WriteVal(EMA3period,1)+
" ) period EMA is moving "+WriteIf(degrees3 > 0,"UP ","Down ")+"(
"+WriteVal(degrees3,1)+" )" +" Degrees";
----- Original Message -----
From: "scourt2000" <stevehite@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, December 24, 2003 4:51 PM
Subject: [amibroker] Anyone have any ideas on how to calc an angle on a 34
EMA?
>
> In general, to calculate an angle on a line is just
>
> atan(abs((y2-y1)/(x2-x1)) * 180 / pi
>
> I would like to calculate the angle of a 34 ema, possibly the last
> 10-15 bars. I started off like this:
>
> Take a linear regression line through the 34 ema:
>
> array = LinearReg(EMA(Close, 34), 10);
> angle = atan(abs(array[BarCount-1] - array[BarCount-11])/10.0) *
> 180 / 3.1459;
>
> What I'm finding is that the angle is way too small in comparison to
> that I'm seeing on the screen. It's as though using the x-axis with
> just bar counts is throwing off the slope.
>
> Any ideas greatly appreciated,
>
> Steve
>
>
>
> 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
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/amibroker/
>
> To unsubscribe from this group, send an email to:
> amibroker-unsubscribe@xxxxxxxxxxxxxxx
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.555 / Virus Database: 347 - Release Date: 12/24/2003
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
------------------------ 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/GHeqlB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|