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

Re: [amibroker] AFL: Slope of a moving average (curve) v. a straight line (for ex. a trendline)


  • To: <amibroker@xxxxxxxxxxxxxxx>
  • Subject: Re: [amibroker] AFL: Slope of a moving average (curve) v. a straight line (for ex. a trendline)
  • From: "Anthony Faragasso" <ajf1111@xxxxxxxx>
  • Date: Sun, 10 Jul 2005 19:30:07 -0400

PureBytes Links

Trading Reference Links

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);

Radians2=atan(EMAMedium);

Radians3=atan(EMASlow);

degrees=Radians*(180/PI);

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,styleCandle);

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 -----
Sent: Friday, July 08, 2005 10:17 AM
Subject: [amibroker] AFL: Slope of a moving average (curve) v. a straight line (for ex. a trendline)

Is it possible using AFL to calculate the slope of, for example, a
moving average? See:

http://cstl.syr.edu/fipse/GraphB/Unit8/Unit8a.html

Calculating the slope of the line tangent to the curve should be, I'm
assuming, straightfoward. I'm guessing the thornier question is how to
find the line that is tangent to a particular day or period.

Thoughts or suggestions?

Thanks.

Harold Harper
harold@xxxxxxxxxxxxx






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


No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.11/45 - Release Date: 7/9/2005


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




No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.11/45 - Release Date: 7/9/2005