Friday, 5 September 2014

A Nice Explorer for Amibroker (AFL)


https://www.facebook.com/StocKanalysisBd?ref=hl

Explorer for Amibroker (AFL)





function T3(price,periods)
{
 s = 0.84;
 e1=EMA(price,periods);
 e2=EMA(e1,Periods);
 e3=EMA(e2,Periods);
 e4=EMA(e3,Periods);
 e5=EMA(e4,Periods);
 e6=EMA(e5,Periods);
 c1=-s*s*s;
 c2=3*s*s+3*s*s*s;
 c3=-6*s*s-3*s-3*s*s*s;
 c4=1+3*s+s*s*s+3*s*s;
 Ti3=c1*e6+c2*e5+c3*e4+c4*e3;
 return ti3;
}

//WAD
TrueRangeHigh=Max( Ref(Close,-1), High );
TrueRangeLow=Min( Ref(Close,-1), Low );
WAD = Cum(IIf(C > Ref(C,-1),C-TrueRangeLow, IIf(C < Ref(C,-1),C-TrueRangeHigh,0)));
wadup = WAD > EMA (WAD,20);
waddn = WAD < EMA (WAd,20);
wadbl = Cross(WAD, EMA(WAD,20));
wadbr = Cross(EMA(WAD,20), WAD);
wad_status= WriteIf(wadup, "Bullish Zone", WriteIf(waddn, "Bearish Zone", WriteIf(wadbl, "Bullish Cross", WriteIf(wadbr, "Bearish Cross", "Zilch"))));
wad_Col=IIf(wadup OR wadbl, colorGreen, IIf(waddn OR wadbr, colorRed, colorLightGrey));


//Trend Strength
up = ADX(10) > 20;
down = ADX(10) < 20;
choppy = ADX(10) < PDI(10) AND ADX(10) < MDI(10);
adx_status= WriteIf(up, "Strong Trend", WriteIf(down, "Weak Trend", WriteIf( choppy, "Choppy", "Zilch")));
adx_Col=IIf(up, colorGreen, IIf(down, colorRed, IIf(Choppy, colorPink, colorLightGrey)));

// Coppock
r1=ROC(C,14);
r2=ROC(C,11);
ck=EMA((r1+r2),10);
upt=IIf(ck>0 AND ROC(ck,1)>0,ck,0);
ups=IIf(ck>0 AND ROC(ck,1)<0,ck,0);
downs=IIf(ck<0 AND ROC(ck,1)>0,ck,0);
down=IIf(ck<0 AND ROC(ck,1)<0,ck,0);
cop_status= WriteIf(upt, "Uptrend", WriteIf(ups, "Uptrend Sidways", WriteIf(downs, "Downtrend Sideways", WriteIf(down, "Downtrend", "Zilch"))));
cop_Col=IIf(upt, colorDarkGreen, IIf(ups, colorGreen, IIf(downs, colorOrange, IIf(down, colorRed, colorLightGrey))));

//Initial Buy Signal
Ibuy =  Cross(RSI(14), EMA(RSI(14),9));
Isell = Cross(EMA(RSI(14),9), RSI(14));
Ibuy = ExRem(Ibuy, ISell);
Isell = ExRem(ISell, Ibuy);
BlRSI = RSI(14) > EMA(RSI(14),9);
BrRSI = RSI(14) < EMA(RSI(14),9);
Ibuy_status= WriteIf(Ibuy, "Buy Warning", WriteIf(Isell, "Sell Warning", WriteIf(BlRSI, "Bullish Zone", WriteIf(BrRSI, "Breaish Zone", "Zilch"))));
I_Col=IIf(Ibuy OR BlRSI, colorGreen, IIf(Isell OR BrRSI, colorRed, colorLightGrey));

//BB Breakout
bbk2 = Cross(RSI(14),30) AND
RSI(14) > Ref(RSI(14),-1);
bbk_status= WriteIf(bbk2, "Break RSI", "Zilch" );
bbk_Col=IIf(bbk2, colorGreen, colorLightGrey);


//Price Smoothing
TBuy = Cross (T3(C,3), T3(C,5));
TSell =  Cross (T3(C,5), T3(C,3));
TBuy = ExRem(TBuy, TSell);
TSell = ExRem(TSell, TBuy);
Tbuy_status= WriteIf(TBuy, "Buy", WriteIf(TSell, "Sell", "Zilch"));
T_Col=IIf(TBuy, colorGreen, IIf(TSell, colorRed, colorLightGrey));

//Guppy MMA
P1 = EMA(C,3);
P2 = EMA(C,5);
P3 = EMA(C,8);
P4 = EMA(C,10);
P5 = EMA(C,12);
P6 = EMA(C,15);
P7 = EMA(C,30);
P8 = EMA(C,35);
P9 = EMA(C,40);
P10 = EMA(C,45);
P11 = EMA(C,50);
P12 = EMA(C,55);
P13 = EMA(C,60);
GBuy = Cross (P1,P8);
GSell = Cross(P8,P1);
GBuy = ExRem(GBuy, GSell);
GSell = ExRem(GSell, GBuy);
Gbuy_status= WriteIf(GBuy, "Buy", WriteIf(GSell, "Sell", "Zilch"));
G_Col=IIf(GBuy, colorGreen, IIf(GSell, colorRed, colorLightGrey));

//EMA-9
MAbuy = Cross(C, EMA(C,9));
MAsell= Cross(EMA(C,9),C);
MAbuy = ExRem(MAbuy, MAsell);
MAsell = ExRem(MAsell, MAbuy);
MA1 = C > EMA(C,9);
MA11 = C < EMA(C,9);
MA_status= WriteIf(MAbuy, "Buy", WriteIf(MAsell, "Sell", WriteIf(MA1, "Bullish", WriteIf(MA11, "Bearish","Zilch"))));
MA_Col=IIf(MAbuy OR MA1, colorGreen, IIf(MAsell OR MA11, colorRed, colorLightGrey));

//EMA-20
MA2buy = Cross(C, EMA(C,20));
MA2sell= Cross(EMA(C,20),C);
MA2buy = ExRem(MA2buy, MA2sell);
MA2sell = ExRem(MA2sell, MA2buy);
MA2 = C > EMA(C,20);
MA22 = C < EMA(C,20);
MA2_status= WriteIf(MA2buy, "Buy", WriteIf(MA2sell, "Sell", WriteIf(MA2, "Bullish", WriteIf(MA22, "Bearish","Zilch"))));
MA2_Col=IIf(MA2buy OR MA2, colorGreen, IIf(MA2sell OR MA22, colorRed, colorLightGrey));

//EMA-9 x 20
MA3buy = Cross(EMA(C,9), EMA(C,20));
MA3sell= Cross(EMA(C,20),EMA(C,9));
MA3buy = ExRem(MA3buy, MA3sell);
MA3sell = ExRem(MA3sell, MA3buy);
MA3 = EMA(C,9) > EMA(C,20);
MA33 = EMA(C,9) < EMA(C,20);
MA3_status= WriteIf(MA3buy, "Buy", WriteIf(MA3sell, "Sell", WriteIf(MA3, "Bullish", WriteIf(MA33, "Bearish","Zilch"))));
MA3_Col=IIf(MA3buy OR MA3, colorGreen, IIf(MA3sell OR MA33, colorRed, colorLightGrey));

//Midterm Bullish or Bearish
mBull = C > EMA(C,50);
mBear= C < EMA(C,50);
mt_status= WriteIf(mBull, "Bullish", WriteIf(mBear, "Bearish", "Zilch"));
mt_Col=IIf(mBull, colorGreen, IIf(mbear, colorRed, colorLightGrey));

//Longterm Bullish or Bearish
Bull = C > EMA(C,200);
Bear= C < EMA(C,200);
lt_status= WriteIf(Bull, "Bullish", WriteIf(Bear, "Bearish", "Zilch"));
lt_Col=IIf(Bull, colorGreen, IIf(bear, colorRed, colorLightGrey));

//Long-term Price Trend
rc= C > EMA (C,50) AND C < EMA(C,200) AND EMA(C,50) < EMA(C,200);
ac=  C > EMA (C,50) AND C > EMA(C,200) AND EMA(C,50) < EMA(C,200);
bl= C > EMA (C,50) AND C > EMA(C,200) AND EMA(C,50) > EMA(C,200);
wr= C < EMA (C,50) AND C > EMA(C,200) AND EMA(C,50) > EMA(C,200);
ds= C < EMA (C,50) AND C < EMA(C,200) AND EMA(C,50) > EMA(C,200);
br= C < EMA (C,50) AND C < EMA(C,200) AND EMA(C,50) < EMA(C,200);

ltp=WriteIf(rc, "RECOVERY", WriteIf(ac, "ACCUMULATION", WriteIf(bl, "BULLISH", WriteIf(wr, "WARNING",WriteIf(ds, "DISTRIBUTION",WriteIf(br, "BEARISH", "Zilch"))))));
ltp_col=IIf( rc, colorBlue, IIf( ac, colorGreen, IIf(bl, colorDarkGreen, IIf(wr, colorOrange, IIf(ds, colorRed, IIf(br, colorDarkRed, colorLightGrey ))))));

G=((O-Ref(L,-1))/Ref(L,-1))*100;
F=((C-Ref(C,-1))/Ref(C,-1))*100;

//T-3 Delta
T3Day = T3(Close, 3);
T5Day = T3(Close, 5);
Delta = T3Day - T5Day;


// Filter=O<Ref(L,-1) AND C>Ref(C,-1)|C>Ref(O,-1)
// AND L<Ref(L,-1) AND Ref(L,-1)<Ref(L,-2) AND Ref(L,-2)<Ref(L,-3)
// AND V>Ref(V,-1) AND V>(MA(Ref(V,-1),5)+(MA(Ref(V,-1),5)*0.3)) AND MA(V,21)>50000;

Filter=MA(V,21)>50000 AND Close < 15;

Buy=Filter;

AddColumn(V, "Volome", 1, IIf(V > Ref(V,-1), colorGreen, colorRed),-1);
AddColumn(((V/EMA(Ref(V,-1),10)))*100, "VolSpike %", 1.2, IIf(V> EMA(Ref(V,-1),10), colorBlue, colorRed),-1);
AddColumn(Delta, "Delta",1.2, IIf(delta < 0, colorRed, colorGreen),-1);
AddColumn(C, "Close", 1.2, IIf(C > Ref(C,-1), colorGreen, colorRed),-1);
AddColumn(G,"O Low%",1.2,-1);
AddColumn(F,"C High%",1.2,-1);
AddColumn(RSI(14),"RSI-14",1.2, IIf(RSI(14) > Ref(RSI(14),-1), colorGreen, colorRed),-1);
AddColumn(ADX(10),"ADX-10",1.2,IIf(ADX(10) > Ref(ADX(10),-1), colorGreen, colorRed),-1);
AddTextColumn(bbk_status, "Breaks", 1.6, colorWhite, bbk_Col,-1);
AddTextColumn(Tbuy_status, "T3-Signal", 1.6, colorWhite, T_Col,-1);
AddTextColumn(Gbuy_status, "Guppy", 1.6, colorWhite, G_Col,-1);
AddTextColumn(MA_status, "EMA-9", 1.6, colorWhite, MA_Col,-1);
AddTextColumn(MA2_status, "EMA-20", 1.6, colorWhite, MA2_Col,-1);
AddTextColumn(MA3_status, "EMA-9x20", 1.6, colorWhite, MA3_Col,-1);
AddTextColumn(Ibuy_status, "RSI signal", 1.6, colorWhite, I_Col,-1);
AddTextColumn(adx_status, "Trend", 1.6, colorWhite, adx_Col,-1);
AddTextColumn(cop_status, "Coppock", 1.6, colorWhite, cop_Col,-1);
//AddTextColumn(wad_status, "WAD", 1.6, colorWhite, WAD_Col,-1);
//AddTextColumn(mt_status, "EMA-50", 1.6, colorWhite, mt_Col,-1);
//AddTextColumn(lt_status, "EMA-200", 1.6, colorWhite, lt_Col,-1);
AddTextColumn(ltp, "Phase", 1.6, colorWhite, ltp_Col,-1);

No comments:

Post a Comment

Thanks