//Copyright Kamalesh Langote. Email:kpl@vfmdirect.com. Visit http://www.vfmdirect.com/kplswing for latest code and updates //Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then double click indicator. //The indicator will now load in a seperate pane/window //Default value of N is 20. You can change this via the Parameters dialog box _SECTION_BEGIN("Price"); 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("KPL Swing"); no=Param( "Swing", 20, 1, 100 ); res=HHV(H,no); sup=LLV(L,no); avd=IIf(C>Ref(res,-1),1,IIf(Ctsl,colorBlue,colorRed),styleOwnScale|styleArea|styleNoLabel, -0.5, 100 ); // arrows code Buy=Cross(C,Ref(res,-1)); Sell=Cross(Ref(sup,-1),C); shape=Buy*shapeUpArrow + Sell*shapeDownArrow; PlotShapes(shape,colorBlack,0,IIf(Buy,Low,High)); _SECTION_END();