Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
GANN with (Buy-Sell-SL-Targer) for Amibroker (AFL)
Copy & Paste Friendly
Back
//------------------------------------------------------------- Period = Optimize("Period", 17, 2, 200, 1); EMACALC = EMA(C, Period); cond1 = Close > EMACALC AND MACD() > Signal(); cond2 = Close > EMACALC AND MACD() < Signal() OR Close < EMACALC AND MACD() > Signal(); cond3 = Close < EMACALC AND MACD() < Signal(); _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 ) ) )); SetBarFillColor(IIf(Cond1,ParamColor("Candle UP Color", colorGreen),IIf(Cond3,ParamColor("Candle Down Color", colorRed),colorBlack))); Plot(C,"\nPrice",IIf(cond1,ParamColor("Wick UP Color", colorDarkGreen),IIf(cond3,ParamColor("Wick Down Color", colorDarkRed),colorBlack)),64,0,0,0,0); //Plot( C, "Close", ParamColor("Color", colorgreen ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); _SECTION_END(); //============== TITLE ============== _SECTION_BEGIN("Title"); Title = EncodeColor(colorGold)+ EncodeColor(colorRose)+" (" + Name() + ") " + EncodeColor(colorGold)+ Interval(2) + " " + Date() +" " +" • Open "+WriteVal(O,1.20)+" • "+"High "+WriteVal(H,1.20)+" • "+"Low "+WriteVal(L,1.20)+" • "+ "Close "+WriteVal(C,1.20)+" • Variação R$ = " +WriteVal(C-Ref(C,-1),1.20,0)+" • Variação % = " +WriteVal((C-Ref(C,-1))*100/Ref(C,-1),1.2)+ "% • Volume = "+ WriteVal(V,1.0); upbar = COND1; downbar = COND3; /* Colourized price bars drawn here */ Graph0 = Close; Graph0Style = 64;//number 64 = candlestick or 128 = bar; barcolor = IIf( downbar, 4, IIf( upbar, 5, 20 ) );//number 4 = red, number 5 = green and number 42 = yellow; Graph0BarColor = ValueWhen( barcolor != 0, barcolor ); _SECTION_END(); Plot(EMACALC, "EMACALC", colorBlack, styleLine,0,0,0,0,2); //------------------------------------ _SECTION_BEGIN("GaNN Square of Nine"); BarsToday = 1 + BarsSince( Day() != Ref(Day(), -1)); StartBar =Open; setvalue = RefOpen = ValueWhen(TimeNum() == 103000, Open,1); //RefOpen = ValueWhen(TimeNum() , Open,1); BaseNum = (int(sqrt(RefOpen))-1); sBelow = BaseNum + BaseNum; sBelowI = 1; //Calculate levels for GANN Square of Nine for( i = 1; i < 50; i++ ) { VarSet( "GANN"+i, (BaseNum * BaseNum) ); BaseNum = BaseNum + 0.125; sBelowI = IIf( VarGet("GANN"+i)< RefOpen, i, sBelowI); bAboveI = sBelowI + 1; sBelow = round(VarGet("GANN"+sBelowI)); bAbove = round(VarGet("GANN"+bAboveI)); } // Resistance Levels (or Targets for Buy trade) BTgt1 = 0.9995 * VarGet("Gann"+(bAboveI+1)); BTgt2 = 0.9995 * VarGet("Gann"+(bAboveI+2)); BTgt3 = 0.9995 * VarGet("Gann"+(bAboveI+3)); BTgt4 = 0.9995 * VarGet("Gann"+(baboveI+4)); BTgt5 = 0.9995 * VarGet("Gann"+(bAboveI+5)); BTgt6 = 0.9995 * VarGet("Gann"+(baboveI+6)); // Support Levels (or Targets for Short trade) STgt1 = 1.0005 * VarGet("Gann"+(sBelowI-1)); STgt2 = 1.0005 * VarGet("Gann"+(sBelowI-2)); STgt3 = 1.0005 * VarGet("Gann"+(sBelowI-3)); STgt4 = 1.0005 * VarGet("Gann"+(sbelowI-4)); STgt5 = 1.0005 * VarGet("Gann"+(sBelowI-5)); STgt6 = 1.0005 * VarGet("Gann"+(sBelowI-6)); Sstop= babove-((babove-sbelow)/3) ; Bstop= sbelow+((babove-sbelow)/3) ; //BuySignal = TimeNum() AND Cross(C,babove); //ShortSignal = TimeNum() AND Cross(Sbelow,C); //----- Plot(bAbove,"\n Buy Trigger",colorBrightGreen, styleStaircase,0,0,0,1); Plot(sBelow,"\n Sell Trigger",colorRed, styleStaircase,0,0,0,1); Plot(BTgt1,"\n Buy Trigger",colorWhite, styleDashed,0,0,0,1); Plot(BTgt2,"\n Buy Trigger",colorWhite, styleDashed,0,0,0,1); Plot(BTgt3,"\n Buy Trigger",colorWhite, styleDashed,0,0,0,1); Plot(BTgt4,"\n Buy Trigger",colorWhite, styleDashed,0,0,0,1); Plot(BTgt5,"\n Buy Trigger",colorWhite, styleDashed,0,0,0,1); Plot(BTgt6,"\n Buy Trigger",colorWhite, styleDashed,0,0,0,1); Plot(STgt1,"\n Sell Trigger",colorWhite, styleDashed,0,0,0,1); Plot(STgt2,"\n Sell Trigger",colorWhite, styleDashed,0,0,0,1); Plot(STgt3,"\n Sell Trigger",colorWhite, styleDashed,0,0,0,1); Plot(STgt4,"\n Sell Trigger",colorWhite, styleDashed,0,0,0,1); Plot(STgt5,"\n Sell Trigger",colorWhite, styleDashed,0,0,0,1); Plot(STgt6,"\n Sell Trigger",colorWhite, styleDashed,0,0,0,1); //----- BuySignal = TimeNum()>103000 AND Cross(C,babove); ShortSignal = TimeNum()>103000 AND Cross(Sbelow,C); BuySignal = ExRem(BuySignal,ShortSignal); ShortSignal = ExRem(ShortSignal,BuySignal); ShortProfitStop= (STgt1 AND L<=Stgt1 AND C>Stgt1) OR (STgt2 AND L<=Stgt2 AND C>Stgt2) OR (STgt3 AND L<=Stgt3 AND C>Stgt3) OR (STgt4 AND L<=Stgt4 AND C>Stgt4) OR (STgt5 AND L<=Stgt5 AND C>Stgt5) OR (STgt6 AND L<=Stgt6 AND C>Stgt6); BuyProfitStop= (Btgt1 AND H>=btgt1 AND C<Btgt1) OR (Btgt2 AND H>=Btgt2 AND C<btgt2) OR (Btgt3 AND H>=Btgt3 AND C<btgt3) OR (Btgt4 AND H>=Btgt4 AND C<btgt4) OR (Btgt5 AND H>=Btgt5 AND C<btgt5) OR (Btgt6 AND H>=Btgt6 AND C<btgt6); Buy = BuySignal; Sell = C<Bstop ; Short = ShortSignal; Cover = C>SStop ; Buy = ExRem(Buy,Sell); Sell = ExRem(Sell,Buy); Short = ExRem(Short,Cover); Cover = ExRem(Cover,Short); Sstop= round(babove) ; Bstop= round(sbelow) ; _SECTION_BEGIN("Background text"); SetChartBkColor(colorBlack); strWeekday = StrMid("---SUNDAY---MONDAY--TUESDAYWEDNESDAY-THURSDAY--FRIDAY--SATURDAY", SelectedValue(DayOfWeek())*9,9); GraphXSpace=Param("GraphXSpace",0,-55,200,1); C13=Param("fonts",20,10,30,1 ); C14=Param("left-right",2.1,1.0,5.0,0.1 ); C15=Param("up-down",12,1,20,1 ); Miny = Status("axisminy"); Maxy = Status("axismaxy"); lvb = Status("lastvisiblebar"); fvb = Status("firstvisiblebar"); pxwidth = Status("pxwidth"); pxheight = Status("pxheight"); YC=TimeFrameGetPrice("C",inDaily,-1); DD=Prec(C-YC,2); xx=Prec((DD/YC)*100,2); GfxSetBkMode(transparent=1); GfxSetOverlayMode(1); GfxSelectFont("Candara", Status("pxheight")/C13 ); GfxSetTextAlign( 6 ); GfxSetTextColor( ColorRGB (217,217,213)); GfxTextOut( Name(), Status("pxwidth")/C14, Status("pxheight")/C15+200); GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 ); GfxSetTextColor(ColorRGB (217,217,213)); GfxTextOut( "L.T.P. : "+ C +"", Status("pxwidth")/C14, Status("pxheight")/C15*2+200 ); GfxSelectFont("Candara", Status("pxheight")/C13*0.5 ); GfxSetTextColor( ColorRGB (103,103,103)); GfxTextOut( ""+DD+ " ( "+xx+"%)", Status("pxwidth")/C14, Status("pxheight")/C15*2.5+200); GfxSelectFont("Calibri", 14, 800 ); GfxSetTextColor( ColorRGB (0,265,0)); GfxTextOut( "Buy Above :"+sstop+"", Status("pxwidth")/C14-525, Status("pxheight")/C15*0.5); GfxSetTextColor( ColorRGB (255,74,74)); GfxTextOut( "Buy S/L :"+Bstop+"", Status("pxwidth")/C14-525, Status("pxheight")/C15*2.6); GfxSetTextColor( ColorRGB (265,0,0)); GfxTextOut( "Sell Below :"+bstop+"", Status("pxwidth")/C14-350, Status("pxheight")/C15*0.5); GfxSetTextColor( ColorRGB (100,255,100)); GfxTextOut( "Sell S/L :"+sstop+"", Status("pxwidth")/C14-350, Status("pxheight")/C15*2.6); GfxSetTextColor( ColorRGB (0,265,0)); GfxTextOut( "Buy TGT 1 : "+BTgt1+"", Status("pxwidth")/C14-525, Status("pxheight")/C15*0.8); GfxTextOut( "Buy TGT 6 : "+BTgt6+"", Status("pxwidth")/C14-525, Status("pxheight")/C15*2.3); GfxTextOut( "Buy TGT 2 : "+BTgt2+"", Status("pxwidth")/C14-525, Status("pxheight")/C15*1.1); GfxTextOut( "Buy TGT 5 : "+BTgt5+"", Status("pxwidth")/C14-525, Status("pxheight")/C15*2.0); GfxTextOut( "Buy TGT 3 : "+BTgt3+"", Status("pxwidth")/C14-525, Status("pxheight")/C15*1.4); GfxTextOut( "Buy TGT 4 : "+BTgt4+"", Status("pxwidth")/C14-525, Status("pxheight")/C15*1.7); GfxSetTextColor( ColorRGB (265,0,0)); GfxTextOut( "Sell TGT 1 : "+STgt1+"", Status("pxwidth")/C14-350, Status("pxheight")/C15*0.8); GfxTextOut( "Sell TGT 6 : "+STgt6+"", Status("pxwidth")/C14-350, Status("pxheight")/C15*2.3); GfxTextOut( "Sell TGT 2 : "+STgt2+"", Status("pxwidth")/C14-350, Status("pxheight")/C15*1.1); GfxTextOut( "Sell TGT 5 : "+STgt5+"", Status("pxwidth")/C14-350, Status("pxheight")/C15*2); GfxTextOut( "Sell TGT 3 : "+STgt3+"", Status("pxwidth")/C14-350, Status("pxheight")/C15*1.4); GfxTextOut( "Sell TGT 4 : "+STgt4+"", Status("pxwidth")/C14-350, Status("pxheight")/C15*1.7); _SECTION_END(); _SECTION_BEGIN("Title"); DODay = TimeFrameGetPrice("O", inDaily); DHiDay = TimeFrameGetPrice("H", inDaily); DLoDay = TimeFrameGetPrice("L", inDaily); Title = EncodeColor(colorWhite)+EncodeColor(colorCustom8)+ EncodeColor(colorCustom10)+ Interval(2) + ", " + EncodeColor(colorCustom11)+Date() + EncodeColor(colorCustom14)+" - "+strWeekday + " - " + EncodeColor(colorBlue) + "Open " + EncodeColor(colorWhite) + O + EncodeColor(colorRed)+ " High : " +EncodeColor(colorWhite) + H + EncodeColor(colorBrightGreen)+ " Low : " +EncodeColor(colorWhite) + L + EncodeColor(colorCustom16) +" Close : " + EncodeColor(colorWhite) +C + EncodeColor(colorBlue)+ " Day-Open : " +DODay + EncodeColor(colorBrightGreen)+" Day-High : " +DHiDay +EncodeColor(colorRed)+ " Day-Low : " + DLoDay ; //---------------------------------