Moving Averages Cross Over 5 days and 20 day with scan for Amibroker (AFL)
Anthony almost 16 years ago Amibroker (AFL)
Here is simple Chart and Scanner Moving Averages. Good lesson for the newbie to know AFL
Indicator / Formula
Copy & Paste Friendly
_SECTION_BEGIN("");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("MA5-MA20 Crossover");
Buy = Cross( MA( Close, 5 ), MA( Close, 20 ) );
Sell = Cross( MA( Close, 20 ), MA( Close, 5 ) );
PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-15);
PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorGreen, 0,Low, Offset=-15);
_SECTION_END();
Plot( MA( Close,5 ),"MA5",colorRed,styleLine);
Plot( MA( Close,20),"MA20",colorBlue,styleLine);0 comments
Leave Comment
Please login here to leave a comment.