Join our facebook group for Amibroker afl code discussion https://www.facebook.com/groups/603980776889348

MACD Magic Zone Buy Sell Trading System

MACD Magic Zone Buy Sell Trading System
MACD Magic Zone Buy Sell Trading System

//www.aflcode.com
_SECTION_BEGIN("MACD");
A1=EMA(C,13)-EMA(C,34);  
A2=MA(C,5)-EMA(C,34); 
A3=MA(C,5)-EMA(C,13); 
Buy_ema = EMA(C,5) > EMA(C,34) AND EMA(C,5) > EMA(C,13);
Sell_ema = EMA(C,5) < EMA(C,34) AND EMA(C,5) < EMA(C,13); 

//Plot(a1,"main",IIf(A1 > Ref(a1,-1), colorBrightGreen, colorRed),styleDots+styleThick);
//Plot(a2,"mid",IIf(A2 > Ref(a2,-1), colorBrightGreen, colorRed),styleThick);
//Plot(a3,"trigger",IIf(A3 > Ref(a3,-1), colorBrightGreen, colorRed),styleDashed);


Buy = Buy_ema AND a2 > Ref(a2, -1)AND a3 > Ref(a3,-1) ;
Sell = Sell_ema AND a2 < Ref(a2, -1)AND a3 < Ref(a3,-1) ;
//Buy = ExRem(Buy,Sell);
//Sell = ExRem(Sell,Buy);
Col = IIf(Buy,colorBrightGreen,IIf(Sell,colorRed,colorDarkGrey));

Plot(30,"",Col,styleThick);
Plot(70,"",Col,styleNoLabel);
Plot(30.5,"",Col,styleNoLabel);
Plot(70.5,"",Col,styleNoLabel);
//Plot(-0.2,"",Col,styleNoLabel);
e = EMA(RSI(21),5);
Plot(e,"",IIf(e > Ref(e,-1),colorBrightGreen,colorRed));

_SECTION_END();

Title =
WriteIf(a1 > 0, EncodeColor(colorBrightGreen),EncodeColor(colorRed))+"MAIN     "+
WriteIf(a1 > Ref(a1,-1), EncodeColor(colorBrightGreen)+"POS",EncodeColor(colorRed)+"NEG")+round(a1*10)/10+
"\n"+
WriteIf(a2 > 0, EncodeColor(colorBrightGreen),EncodeColor(colorRed))+"MID       "+
WriteIf(a2 > Ref(a2,-1), EncodeColor(colorBrightGreen)+"POS",EncodeColor(colorRed)+"NEG")+round(a2*10)/10+
"\n"+
WriteIf(a3 > 0, EncodeColor(colorBrightGreen),EncodeColor(colorRed))+"Trigger "+
WriteIf(a3 > Ref(a3,-1), EncodeColor(colorBrightGreen)+"POS",EncodeColor(colorRed)+"NEG")+round(a3*10)/10
;
Previous
Next Post »