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

[amibroker] Re: ANGLE/ Degree



PureBytes Links

Trading Reference Links

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@xxx> 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.35/680 - Release Date: 2/10/2007 9:15 PM