.

Line Chart Accurate Buy Sell Signals - Amibroker AFL Code

Click Image To Enlarge. Please Rate And Comment.

Line Chart Accurate Buy Sell Signals

_SECTION_BEGIN("COWABUNGA");

E5 = EMA(C, 5);
E10 = EMA(C, 10);

R = RSI(9);
SK = StochK(10, 3);
SD = StochD(10, 3, 3);
MH = MACD(12, 26) - Signal(12, 26, 9);

//Conditions for Buying

Cond1 = E5 > E10;
Cond2 = R > 50;
Cond3 = SD < 80 AND SD > Ref(SD, -1);
Cond4 = MH > 0 OR (MH < 0 AND MH > Ref(MH, -1));

//Conditions for Selling

Cond5 = E10 > E5;
Cond6 = R < 50;
Cond7 = SD > 20 AND SD < Ref(SD, -1);
Cond8 = MH < 0 OR (MH > 0 AND MH < Ref(MH, -1));

Buy = Cond1 AND Cond2 AND Cond3 AND Cond4;
Sell = Cond5 AND Cond6 AND Cond7 AND Cond8;

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

Plot(C, "", colorGrey40, styleBar);
Plot(E5, "EMA5", colorGreen, styleLine);
Plot(E10,"EMA10", colorRed, styleLine);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-20);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-30); 
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-25); 
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30); 
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);

_SECTION_END();
Previous Post Next Post