Kpl Swing Afl Code

Kpl Swing afl Code for Amibroker




_SECTION_BEGIN("Swing10");

no=Param( "Swing", 1, 1, 55 );
tsl_col=ParamColor( "Color", colorWhite);
 
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);
 
Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea
 
Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), colorBrightGreen, layer = 0,yposition = Low, offset = -15);
PlotShapes( IIf( Sell, shapeDownArrow, shapeNone ), colorRed, layer = 0, yposition = High, offset = -15);

_SECTION_END();

_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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();
No comments :

No comments :

Post a Comment