5-6 EMA Closing Price Crossover - Amibroker AFL Code

Click Image To Enlarge. Please Rate And Comment.

5-6 EMA Closing Price Crossover

//Title="this is for automatic wrapping of title text 
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +
WriteVal( V, 1.0 ) +
" {{VALUES}}", 
O, H, L, C, SelectedValue( ROC( C, 1 )) ));

// This part will plot the EMA value of 5days close and 6 days open price

EMAstyle=ParamStyle("MAType",styleLine,maskAll ); 
Plot(EMA(Close,5), "EMA(CLOSE_5)", colorGreen, EMAstyle, Null, Null ); 
Plot(EMA(O,6), "EMA(OPEN_6)", colorRed, EMAstyle, Null, Null ); 

// This part will plot Closing price with barstyle choosen by user

ChartStyl=ParamStyle("Chart Type", styleBar,maskAll );
Chartcolor=ParamColor("Chart Colour",maskAll); 
Plot(Close,"Closing price with5,6 EMA",Chartcolor,ChartStyl);

// This part will find the buy and sell point in the chart
Buy= MACD()>=Signal();
//Buy=Cross(EMA(Close,5),EMA(Open,6)); AND MACD(12,26)>=Signal(12,26,9);
Sell=Cross(EMA(C,5),EMA(O,6))AND MACD()<Signal();
Buy     = ExRem(Buy, Sell);
Sell    = ExRem(Sell, Buy);
Signalshape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes( Signalshape, IIf( Buy, colorGreen, colorRed ),0, IIf( Buy, Low, High ) );
//IIf (Buy,PlotShapes(shapeUpArrow,colorGreen,0,Low),PlotShapes(shapeDownArrow,colorRed,0,High));
Previous Post Next Post