AFL For Intraday Swing Traders.png |
//www.aflcode.com _SECTION_BEGIN(""); SetChartOptions(0,chartShowArrows|chartShowDates); SetChartBkGradientFill( colorGold ,colorBlue); _N(Title = Date()+EncodeColor(colorBlack)+ "Very Accurate AFL For Positional Traders"+ ""+ EncodeColor(colorBlue)+"" +"" + EncodeColor(colorGreen)+ " Open:"+ Open+" ,"+"High:"+High+" ,"+"Low:"+Low+" , "+"Close:"+Close ); Plot(C,"",colorDefault,styleCandle); _SECTION_END(); _SECTION_BEGIN("Trend Blaster V1.2"); SetChartBkColor(ParamColor("Outer panel color ",colorLightYellow)); SetChartBkColor(ParamColor("BackGround Color", colorDarkGrey)); messageboard =ParamToggle("Message Board","Show|Hide",1); no = Optimize("TSL",Param("A (Change To Optimise)",10, 1, 55 ,1),1,20 ,1); multiplier1 = Optimize("Multiplier1", Param("B (Change To Optimise)",5, 1, 55 ,1),1, 25 ,1); multiplier2 = Optimize("Multiplier2", Param("C (Change To Optimise)",22, 1, 55 ,1),1, 25 ,1); showtsl =ParamToggle("Show SL Line","No|Yes"); aggressivemode =ParamToggle("Aggressive Mode","Yes|No",0); stopreverse =ParamToggle("Switch To Stop And Reverse","No|Yes",0); CloseAtEnd = ParamToggle("Close Positions EOD", "No|Yes"); ShowBands = ParamToggle("Show Trending Bands", "No|Yes"); supres=ParamToggle("Show Support / Resistance","No|Yes"); ShowCrossover = ParamToggle("Show Crossover", "No|Yes"); AudioAlert = ParamToggle("Human Voice Alert", "No|Yes"); EmailAlert = ParamToggle("E-mail Alert", "No|Yes"); AlertOutput = ParamToggle("Alert Output", "No|Yes"); showtrendline = ParamToggle("Show Trend Line", "No|Yes"); fibs = ParamToggle("Plot Fibonacci Retracement","No|Yes"); text = ParamToggle("Plot Fibonnaci As Text","No|Yes",0); mktclose=Param("Market Close Time",152500,000000,235959,1 ); function TBR(no) { dres=HHV(H,no); dsup=LLV(L,no); davd=IIf(H>Ref(dres,-1),1,IIf(L<Ref(dsup,-1),-1,0)); davn=ValueWhen(davd!=0,davd,1); dtsl1=IIf(davn==1,dsup,dres); return dtsl1; } SetChartOptions(0,chartShowArrows|chartShowDates); Plot(Close,"Price",colorBlack, styleCandle); dtsl=TBR(no); Horr=360; Horr1=25; Verr=14; GfxTextOut("POSITIONAL Return val "+TBR(no), Horr , Verr+54 ); dB=H>dtsl; dS=L<dtsl; TimeFrameSet(multiplier1*Interval()); wtsl=TBR(no); WB=H>WTSL; WS=L<WTSL; TimeFrameRestore(); wtsl=TimeFrameExpand(wtsl,multiplier1*Interval(),expandFirst); wb=TimeFrameExpand(WB,multiplier1*Interval(),expandFirst); ws=TimeFrameExpand(WS,multiplier1*Interval(),expandFirst); TimeFrameSet(multiplier2*Interval()); mtsl=TBR(no); MB=H>MTSL;//Cross(H,mtsl); MS=L<MTSL;//Cross(mtsl,L); TimeFrameRestore(); mtsl=TimeFrameExpand(mtsl,multiplier2*Interval(),expandFirst); mb=TimeFrameExpand(MB,multiplier2*Interval(),expandFirst); ms=TimeFrameExpand(MS,multiplier2*Interval(),expandFirst); Buy = IIf((Low > WTSL AND Low > MTSL), DB, ((WB AND Low > DTSL AND Low > MTSL) OR (MB AND Low > DTSL AND Low > WTSL))); Sell=IIf(CloseAtEnd==False, (DS OR (DS AND WS) AND (Low > MTSL)), (DS OR (DS AND WS) AND (Low > MTSL)) OR TimeNum() > mktclose); Short = IIf((High < WTSL AND High < MTSL), DS, (WS AND High < DTSL AND High < MTSL) OR (MS AND High < DTSL AND High < WTSL )); Cover=IIf(CloseAtEnd==False, (DB OR (DB AND WB) AND (High < MTSL)), (DB OR (DB AND WB) AND (High < MTSL)) OR TimeNum() > mktclose); Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); Short=ExRem(Short,Cover); Cover=ExRem(Cover,Short); Long=Flip(Buy,Sell); Shrt=Flip(Short,Cover); Relax = NOT Long AND NOT Buy AND NOT shrt AND NOT Sell AND NOT Sell AND NOT Cover; SellSL=ValueWhen(Short,DTSL,1); BuySL=ValueWhen(Buy,DTSL,1); BuyDifference= BuyPrice - BuySL; SellDifference = SellSL - SellPrice; PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-25); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-35); PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-30); PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=25); PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=35); PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-30); PlotShapes(IIf(Sell, shapeStar, shapeNone),colorGold, 0, L, Offset=-15); PlotShapes(IIf(Cover, shapeStar, shapeNone),colorGold, 0,L, Offset=-15); PlotShapes(IIf(CloseAtEnd==True AND TimeNum() > mktclose AND NOT Relax, shapeStar, shapeNone),colorGold, 0,L, Offset=-15); tsl = IIf(Buy OR Long OR Short OR Shrt AND NOT Relax, dtsl,Null); tslcolor = IIf(Buy OR Long AND NOT Relax, colorGreen, colorRed); Plot(tsl, "",tslcolor, styleLine|styleDots|styleThick); _SECTION_END();
Sign up here with your email
ConversionConversion EmoticonEmoticon