Read First

Credit goes to the creator of the AFL Code. No changes have been made by the Blog owner to the AFL code. The code has been obtained through online resource and is presented on as it is afl are from collection of all over website (www).thanks for the wonderful creating and sharing ideas.

Saturday, January 11, 2014

315 Strategy Amibroker AFL

315 Strategy AFL . This AFL is a 3 EMA & 15 EMA crossover. The AFL includes a trend ribbon which helps in decision making as per the trend prevalent at the time of the cross. When Ribbon is red, preferably the Buy trades should be avoided on crossover and when the ribbon is blue, preferably the sell trades should be avoided on crossover of the 3 EMA.

Moving average crossovers can sometimes be very annoying as they might result in multiple whipsaws and losses . This is mostly the case when the market is in a sideways mode.

confirm another signal or indicator to support the confirmation to trade.

Code here AFL

_SECTION_BEGIN("315 cross"); Plot(Close,"Price",colorBlack, styleCandle); Plot(EMA(Close,3),"3EMA",colorBlue,style=styleThick); Plot(EMA(Close,15),"15EMA",colorRed,style=styleThick); Buy=Cross(EMA(Close,3),EMA(Close,15)); Sell=Cross(EMA(Close,15),EMA(Close,3)); Short=Sell; Cover=Buy; shape = Buy * shapeUpArrow + Sell * shapeDownArrow; PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) ); _SECTION_END(); _SECTION_BEGIN("Magnified Market Price"); //by Vidyasagar, FS=Param("Font Size",30,11,100,1); GfxSelectFont("Times New Roman", FS, 700, True ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorBlack) ); Hor=Param("Horizontal Position",600,1,1200,1); Ver=Param("Vertical Position",1,1,830,1); GfxTextOut(""+C, Hor , Ver ); YC=TimeFrameGetPrice("C",inDaily,-1); DD=Prec(C-YC,2); xx=Prec((DD/YC)*100,2); GfxSelectFont("Times New Roman", 11, 700, True ); GfxSetBkMode( colorWhite ); GfxSetTextColor(ParamColor("Color",colorBlack) ); GfxTextOut(""+DD+" ("+xx+"%)", Hor , Ver+45 ); _SECTION_END(); _SECTION_BEGIN("Ribbon"); no=Param( "Swing", 20, 1, 55 ); 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 ); _SECTION_END();