PureBytes Links
Trading Reference Links
|
hare's a scheme I use. You need different scale factors for different
securities, depending on tick size.
EMAfast = Param("Fast EMA",5,3,25,1);
EMAmedium = Param("Medium EMA",9,2,50,1);
EMAslow = Param("Slow EMA",18, 2,100,1);
LongAngle = Param("Long Angle Min",30,5,90,1);
ShortAngle = -1 * Param("Short Angle Min",30,5,90,1);
function theAngle(period, aFactor) //Computes the angle of an EMA
{theYdist = (EMA(C,period)-Ref(EMA(C,period),-1))*aFactor; // need
right factor for stock or futures
result = round(atan(theYdist)*180/3.14159);
return result;
}
itsastock = True;
scaleFactor = 12.5; //for stocks
theFactor = -1;
if (StrLeft(Name(),3) == "ER2") {thefactor = 10; itsastock = False;}
if (StrLeft(Name(),2) == "6C") {thefactor = 10000; itsastock = False;}
if (StrLeft(Name(),2) == "6E") {thefactor = 10000; itsastock = False;}
if (StrLeft(Name(),2) == "ES") {thefactor = 4; itsastock = False;}
if (StrLeft(Name(),2) == "YM") {thefactor = 1; itsastock = False;}
if (StrLeft(Name(),2) == "QM") {thefactor = 100; itsastock = False;}
if (StrLeft(Name(),2) == "NQ") {thefactor = 2; itsastock = False;}
scaleFactor = IIf(thefactor > 0,thefactor,scaleFactor);
angleSlow = theAngle(EMAslow,scaleFactor);
angleMedium = theAngle(EMAmedium,scaleFactor);
angleFast = theAngle(EMAfast,scaleFactor);
Mel
--- In amibroker@xxxxxxxxxxxxxxx, "o_guba" <o_guba@xxx> wrote:
>
> 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
> > >
> >
>
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
|