Multiple Indicators Accurate Target |
//www.aflcode.com //GfxGradientRect( 180, 30, 1759, 735, ColorRGB(40,40,40), ColorRGB(0,0,40) ); GfxSetOverlayMode(1); GfxSelectPen( ColorRGB(150,0,0), 1 ); GfxSelectSolidBrush( ColorRGB(0,0,40) ); GfxRectangle( 0,750, 1807, 35 ); GfxSelectPen( ColorRGB(150,0,0), 2 ); GfxSelectSolidBrush( ColorRGB(65,65,65) ); GfxPolygon(250,200,200,250,250,20,200,50); //GfxSelectPen( ColorRGB(125,0,0), 1 ); //GfxSelectSolidBrush( ColorRGB(0,0,40) ); //GfxRectangle( 10,100, 190, 160 ); GfxSelectPen( ColorRGB(0,0,0), 1 ); GfxSelectSolidBrush( ColorRGB(0,0,0) ); //GfxSetTextAlign( 250 );// center alignment GfxSetOverlayMode(1); GfxSelectFont("Times New Roman", 40, 400, True ); GfxSetTextColor( ColorRGB( 105, 105, 105 ) ); GfxSetBkMode(0); // transparent GfxTextOut("WIKI-101% PROFIT", 10 , 100 ); _SECTION_BEGIN("Flower"); si=Param("Zoom/In Out",5,-50,100,1); GraphXSpace=si; r1 = Param( "ColorFast avg", 5, 2, 200, 1 ); r2 = Param( "ColorSlow avg", 10, 2, 200, 1 ); r3 = Param( "ColorSignal avg", 5, 2, 200, 1 ); m1=MACD(r1,r2); s1=Signal(r1,r2,r3); mycolor=IIf(m1<0 AND m1>s1, ColorRGB(155,155,155),IIf(m1>0 AND m1>s1,ColorRGB(0,125,0),IIf(m1>0 AND m1<s1,ColorRGB(180,30,160),ColorRGB(100,0,0)))); Prd1=Param("ATR Period",4,1,20,1); Prd2=Param("Look Back",7,1,20,1); green = HHV(LLV(L,Prd1)+ATR(Prd1),Prd2); red = LLV(HHV(H,Prd1)-ATR(Prd1),Prd2); flowerClose = EMA((Open+High+Low+Close)/4,3) ; flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3); Temp = Max(High, flowerOpen); flowerHigh = EMA(Max(Temp, flowerClose),3); Temp = Min(Low,flowerOpen); flowerLow = EMA(Min(Temp, flowerClose),3); barColor=IIf(Close>Open,ColorRGB(0,245,0),ColorRGB(255,0,0)); _SECTION_BEGIN("Support"); Prd2=Param("Sup_Period1",2,0,200,1); test2 = TEMA ( Low , Prd2 ) ; SP = Ref(test2,1) > Low AND test2 < Ref(test2,-1);//Peak SPV0 = ValueWhen(SP,flowerLow,0);//PeakValue0 SPV1 = ValueWhen(SP,flowerLow,1);//PeakValue1 SPV2 = ValueWhen(SP,flowerLow,2);//PeakValue2 MSP = SPV2 > SPV1 AND SPV1 < SPV0 ;//MajorPeak SpColor=ParamColor("SupColor",ColorRGB(0,225,0)); BrCount=Param("SupBarLength",8,1,500,1); for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars { SpColor[i] = colorBlack; } MSPV = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,1); MSPD = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),1); SD = IIf(DateNum() < LastValue(MSPD,lastmode = True ), Null, LastValue(MSPV,Lastmode = True)); Plot(SD,"Support1",SpColor,ParamStyle("SupportLine1",styleDashed|styleNoTitle,maskAll)); SpColor2=ParamColor("SupColor2",ColorRGB(0,200,0)); BrCount=Param("Sup2BarLength",8,1,500,1); for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars { SpColor2[i] = colorBlack; } MSPV2 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,2); MSPD2 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),2); SD2 = IIf(DateNum() < LastValue(MSPD2,lastmode = True ), Null, LastValue(MSPV2,Lastmode = True)); Plot(SD2,"Support2",Spcolor2,ParamStyle("SupportLine2",styleDashed|styleNoTitle,maskAll)); SpColor3=ParamColor("SupColor3",ColorRGB(0,175,0)); BrCount=Param("Sup3BarLength",8,1,500,1); for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars { SpColor3[i] = colorBlack; } MSPV3 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,3); MSPD3 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),3); SD3 = IIf(DateNum() < LastValue(MSPD3,lastmode = True ), Null, LastValue(MSPV3,Lastmode = True)); Plot(SD3,"Support3",SpColor3,ParamStyle("SupportLine3",styleThick|styleDots|styleNoTitle,maskAll)); _SECTION_END(); Title = StrFormat("\\c02 {{NAME}} | {{DATE}} | Open : %g | High : %g | Low : %g | Close : %g | Change = %.1f%% | Volume = " +WriteVal( V, 1.0 ) +", {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ); _SECTION_BEGIN("KPL Swing"); //Copyright Kamalesh Langote. Email:kpl@vfmdirect.com. More details at http://www.vfmdirect.com/kplswing //Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart no=Param( "Swing", 11, 1, 55 ); tsl_col=ParamColor( "Color", colorCycle ); 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); shape=Buy*shapeUpArrow + Sell*shapeDownArrow; PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High)); _SECTION_END(); messageboard = ParamToggle("Message Board","Show|Hide",0); showsl = ParamToggle("Stop Loss Line", "Show|Hide", 0); no=10; 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); s5d=IIf(avn==1,sup,res); if (showsl == 0) //{Plot(s5d,"Stop Loss",colorCustom14,styleDots);} exitlong = Cross(s5d, H); PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10); exitshort = Cross(L, s5d); PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15); if (showsl == 0) //{Plot(s5d,"Stop Loss",colorCustom14,styleDots);} exitlong = Cross(s5d, H); PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10); exitshort = Cross(L, s5d); PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15); Buy = exitshort; Sell = exitlong; //Short = Sell; //Cover = Buy; Buy = ExRem(Buy,Sell); Sell = ExRem(Sell,Buy); //Short = ExRem(Short, Cover); //Cover = ExRem(Cover, Short); AlertIf( Buy, "", "BUY @ " + C, 1 ); AlertIf( Sell, "", "SELL @ " + C, 2 ); for(i=BarCount-1;i>1;i--) { if(Buy[i] == 1) { entry = C[i]; sig = "BUY"; sl = s5d[i]; tar1 = entry + (entry * .0050); tar2 = entry + (entry * .0092); tar3 = entry + (entry * .0179); bars = i; i = 0; } if(Sell[i] == 1) { sig = "SELL"; entry = C[i]; sl = s5d[i]; tar1 = entry - (entry * .0050); tar2 = entry - (entry * .0112); tar3 = entry - (entry * .0212); bars = i; i = 0; } } Offset = 20; Clr = IIf(sig == "BUY", colorLime, colorRed); ssl = IIf(bars == BarCount-1, s5d[BarCount-1], Ref(s5d, -1)); sl = ssl[BarCount-1]; Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset); Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset); Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset); Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset); Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset); for (i=bars; i <BarCount;i++) { PlotText(""+sig+"@"+entry, BarCount+1,entry,Null,colorBlue); PlotText("T1@"+tar1,BarCount+3,tar1,Null,Clr);PlotText("T2@"+tar2,BarCount+3,tar2,Null,Clr);PlotText ("T3@"+tar3,BarCount+3,tar3,Null,Clr); } printf("Last " + sig + " Signal came " + (BarCount-bars) + " bars ago"); printf("\n" + sig + " @ : " + entry + "\nStop Loss : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"+ "\nTarget_1 : " + tar1 + "\nTarget_2 : " + tar2 + "\nTarget_3 : " + tar3); printf("\nCurrent P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)); if (messageboard == 0 ) { GfxSelectFont( "Tahoma", 13, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorWhite ); if ( sig =="BUY") { GfxSelectSolidBrush( colorBlue ); // this is the box background color } else { GfxSelectSolidBrush( colorRed ); // this is the box background color } pxHeight = Status( "pxchartheight" ) ; xx = Status( "pxchartwidth"); Left = 1100; width = 310; x = 5; x2 = 290; y = pxHeight; GfxSelectPen( colorGreen, 1); // broader color GfxRoundRect( x, y - 163, x2, y , 5, 7 ) ; GfxTextOut( ( " Trading System "),88,y-165); GfxTextOut( (" "),27,y-160); GfxTextOut( ("Last " + sig + " Signal came " + (BarCount-bars-1) * Interval()/60 + " mins ago"), 13, y-140) ; // The text format location GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 13, y-120); GfxTextOut( ("Trailing SL : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 13, y-100); GfxTextOut( ("TGT:1 : " + tar1), 13, y -80); GfxTextOut( ("TGT:2 : " + tar2), 13,y-60); GfxTextOut( ("TGT:3 : " + tar3), 13,y-40); GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 88, y-22);; } _SECTION_BEGIN("Magnified Market Price"); FS=Param("Font Size",30,30,100,1); GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorWhite) ); Hor=Param("Horizontal Position",350,800,800,800); Ver=Param("Vertical Position",50,27,27,27); GfxTextOut(""+C,Hor , Ver ); YC=TimeFrameGetPrice("C",inDaily,-1); DD=Prec(C-YC,2); xx=Prec((DD/YC)*100,2); GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True ); GfxSetBkMode( colorWhite ); GfxSetTextColor(ParamColor("Color",colorYellow) ); GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 ); _SECTION_END(); /*Plot EMA*/ Plot( EMA( Close,13), "13 EMA", colorRed,styleLine); Plot( EMA( Close,34), "34 EMA", colorBlue,styleLine); Plot( EMA( Close,55), "55 EMA", colorBlack,styleLine); Plot( EMA( Close,89), "89 EMA", colorYellow,styleLine); /////////////////////////////////////Kpl Swing ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //kpl swing formula here //---- heikin ashi HaClose = (O+H+L+C)/4; HaOpen = AMA( Ref( HaClose, -1 ), .40); HaHigh = Max( H, Max( HaClose, HaOpen ) ); HaLow = Min( L, Min( HaClose, HaOpen ) ); xDiff = (HaHigh - Halow) * IIf(StrFind(Name(),"JPY"),100,10000); // Plot(EMA(HaClose,9),"",colorWhite, styleLine); // Plot(EMA(HaClose,18),"",colorBlack, styleLine); _SECTION_BEGIN("KPL Swing"); no=Param( "Swing", 10, 1, 55 ); tsl_col=ParamColor( "Color", colorCycle ); 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 _SECTION_END(); ////////////////////details of stock at the title _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 ) ) )); _SECTION_END(); /////////////////Stock near days high and low scanner TimeFrameSet(inHourly); H1 = HHV(H, 1) ; H2= (H1-C)< .001*C; L1 = LLV(L,1) ; L2 = (C-L1) < .001*C ; TimeFrameRestore() ; SetOption("NoDefaultColumns", True); AddTextColumn(Name(), "Symbol"); AddColumn(DateTime(), "Date", formatDateTime); AddColumn(C, "CMP", 1.2); Filter = H2 OR L2 ; Buy = H2 ; Sell = L2 ; ///////////////////////////candle stick reader _SECTION_BEGIN("KPL Swing1"); //Copyright Kamalesh Langote. Email:kpl@vfmdirect.com. More details at http://www.vfmdirect.com/kplswing //Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart no=Param( "Swing", 10, 1, 55 ); tsl_col=ParamColor( "Color", colorCycle ); 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); shape=Buy*shapeUpArrow + Sell*shapeDownArrow; PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High)); _SECTION_END(); _SECTION_BEGIN("KPL Swing2"); //Copyright Kamalesh Langote. Email:kpl@vfmdirect.com. More details at http://www.vfmdirect.com/kplswing //Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart no=Param( "Swing", 6, 1, 55 ); tsl_col=ParamColor( "Color", colorCycle ); 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); shape=Buy*shapeUpArrow + Sell*shapeDownArrow; PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High)); _SECTION_END(); _SECTION_BEGIN("KPL Swing3"); //Copyright Kamalesh Langote. Email:kpl@vfmdirect.com. More details at http://www.vfmdirect.com/kplswing //Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart no=Param( "Swing", 3, 1, 55 ); tsl_col=ParamColor( "Color", colorCycle ); 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); shape=Buy*shapeUpArrow + Sell*shapeDownArrow; PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High)); _SECTION_END();
Sign up here with your email
ConversionConversion EmoticonEmoticon