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

[amibroker] Re: ANGLE/ Degree



PureBytes Links

Trading Reference Links

i will try that too,

thanks Wes



--- In amibroker@xxxxxxxxxxxxxxx, Wes Smith <wes_zoltran@xxx> wrote:
>
> From Dennis's Woodies CCI script (made into a function)
> 
> function angle_of(ain)
> {
>     PI = atan(1.00) * 4; 
>     periods = 30; 
>     HighHigh = HHV(H, periods); 
>     LowLow = LLV(L, periods); 
>     range = 25 / (HighHigh - LowLow) * LowLow; 
>     x1 = 0; 
>     x2 = 1; 
>     y1 = 0; 
>     y2 = (Ref(ain, -1) - ain) / Avg * range; 
>     zzz = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)); 
>     angle = round(180 * acos((x2 - x1)/zzz) / PI); 
>     angle = IIf(y2 > 0, - angle, angle); 
> return angle ;
> }
> 
> // Calc angle of AMA, EMA, LSMA and CCI14 
> //
> 
> angle_EMA34 = angle_of(EMA34);
> angle_LSMA = angle_of(Lsma25);
> angle_kama = angle_of(kama);
> angle_cci14 = angle_of(CA);
> 
> ----- Original Message ----
> From: o_guba <o_guba@xxx>
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Monday, February 12, 2007 12:02:50 PM
> Subject: [amibroker] Re: ANGLE/ Degree
> 
> thanks joe, works well!
> 
> Oli
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Joe Landry" <jelandry@> wrote:
> >
> > 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@> 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
> >   > >
> >   >
> >
> 
> 
> 
> 
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
>  
> Yahoo! Groups Links
>



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