PureBytes Links
Trading Reference Links
|
Just checked and this works. Hope it will help you see how slopes are determined and angle is calculated.
JOE L.
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: o_guba
To: amibroker@xxxxxxxxxxxxxxx
Sent: Monday, February 12, 2007 9:45 AM
Subject: [amibroker] Re: ANGLE/ Degree
thanks sai,
but it didn´t worked, perhaps another guy has a formula?
thanks
--- In amibroker@xxxxxxxxxxxxxxx, "sai20_2000" <sai20_2000@xxx> wrote:
>
> This is one of the code for angles I had in my archieve
> CREDITS to the DEveloper
>
> Hope this helps
>
>
> //Angle
>
>
> EMA34=EMA(C,20);
> Lsma=EMA(C,21);
>
> PI = atan(1.00) * 4;
> periods = 30;
> HighHigh =HHV(H, periods);
>
> LowLow =LLV(L, periods);
>
> range = 25 / (HighHigh - LowLow) * LowLow;
>
> x1_EMA34 = 0;
> x2_EMA34 = 2;
> y1_EMA34 = 0;
> y2_EMA34 = (Ref(EMA34, -2) - EMA34) / Avg * range;
>
> c_EMA34 = sqrt((x2_EMA34 - x1_EMA34)*(x2_EMA34 - x1_EMA34) +
> (y2_EMA34 -
> y1_EMA34)*(y2_EMA34 - y1_EMA34));
> angle_EMA34 = round(180 * acos((x2_EMA34 - x1_EMA34)/c_EMA34) / PI);
>
> TitleAngleEMA34 = EncodeColor(colorWhite) + "\nEMA34 angle = ";
>
> angle_EMA34 = IIf(y2_EMA34 > 0, - angle_EMA34, angle_EMA34);
> if(abs(SelectedValue(angle_EMA34)) >= 25)
> {
> TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorLime);
> }
> else if(abs(SelectedValue(angle_EMA34)) >= 15)
> {
> TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorYellow);
> }
> else
> {
> TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorRed);
> }
> TitleAngleEMA34 = TitleAngleEMA34 + angle_EMA34;
> // End Angle of EMA34 ******************
>
>
> Color_ema_20_eangle=TimeFrameExpand(
> IIf(angle_ema34>=15,colorBrightGreen,IIf(angle_ema34<=-
> 15,colorCustom12,
> IIf(angle_ema34>5,colorGreen,IIf(angle_ema34<-
> 5,colorRed,colorDarkYellow)))),in5Minute*2);
>
>
>
> //Plot Ema and LSMA
> pricecolor= IIf(TimeFrameExpand(EMA(C,5),in15Minute*2)>
> TimeFrameExpand(Ref(DEMA(C,5),-4),in15Minute*2),colorGreen,colorRed);
> //pricecolor= IIf(TimeFrameExpand(TimeFrameCompress(DEMA
> (C,5),in15Minute*2),in15Minute*2)>
> //TimeFrameExpand(TimeFrameCompress(Ref(DEMA(C,5),-
> 4),in15Minute*2),in15Minute*2),colorGreen,colorRed);
> //
> //Plot(C,"",colorWhite,styleBar);
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "o_guba" <o_guba@> wrote:
> >
> > how can write in AB an angle or see, if example a line have a 20
> degree?
> > how can i write in AB for example INV TAN?
> > haven`t seen anythig in the help menue?
> >
> > thanks for the answers
> >
>
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.17.37/682 - Release Date: 2/12/2007 1:23 PM
|