Amibroker AFL code for Acceleration Bands:
Please find below the AFL code.
Script:
_SECTION_BEGIN(“Acceleration Bands”);
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( Close, “Price”, colorWhite, styleCandle );
LookbackPeriods = Param(“LookbackPeriods”,20,5,100,5);
range=(H-L)/(H+L)/2;
Upperband=MA(H*(1+2*((2*range)*100)*.01),LookbackPeriods);
Lowerband= MA(L*(1-2*((2*range)*100)*.01),LookbackPeriods);
Middleband=MA(C,LookbackPeriods);
Plot(Upperband, “Upper Band”,colorBlue,styleLine);
Plot(Middleband, “Middle Band”,colorWhite,styleLine);
Plot(Lowerband, “Lower Band”,colorRed,styleLine);
_SECTION_END();