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 ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Gann Square of Nine V1 for Amibroker (AFL)

Rating:
3 / 5 (Votes 5)
Tags:
amibroker

this afl found on net and modified as per my view…!

here in this forum i had posted before but some more modification requies, so posted with all modification which were asked at http://www.wisestocktrader.com/indicators/3836-gann-squar-of-nine

for comodity, you have to change from param settings.

Screenshots

Similar Indicators / Formulas

Kavach Of Karna v2
Submitted by hbkwarez over 10 years ago
Advanced Elliott Waves
Submitted by MarcosEn about 13 years ago
3_6Day GuaiLiLv
Submitted by motorfly about 13 years ago
Williams Alligator System
Submitted by durgesh1712 about 13 years ago
*Level Breakout system*
Submitted by Tinych about 13 years ago
Horizontal Live Priceline Tool
Submitted by northstar about 13 years ago

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("GaNN Square of Nine");

BarsToday = 1 + BarsSince( Day() != Ref(Day(), -1));

StartBar =Open;


RefOpen = ValueWhen(TimeNum() == Param("Stock/",092000,092000,100500,8500), 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()>092000 AND  Cross(C,babove);
ShortSignal = TimeNum()>092000 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);
GfxTextOut( "Sai Stock Broking", Status("pxwidth")/C14, Status("pxheight")/C15*2.5+220);
GfxTextOut( "09825340778", Status("pxwidth")/C14, Status("pxheight")/C15*2.5+240);
GfxSelectFont("Candara", Status("pxheight")/C13*0.5 );
GfxSetTextColor( ColorRGB (0,265,0));
GfxTextOut( "Buy Above :"+sstop+"", Status("pxwidth")/C14-450, Status("pxheight")/C15*6);
GfxSetTextColor( ColorRGB (255,74,74));
GfxTextOut( "Buy S/L :"+Bstop+"", Status("pxwidth")/C14-350, Status("pxheight")/C15*7);
GfxSetTextColor( ColorRGB (265,0,0));
GfxTextOut( "Sell Below :"+bstop+"", Status("pxwidth")/C14+450, Status("pxheight")/C15*6);
GfxSetTextColor( ColorRGB (100,255,100));
GfxTextOut( "Sell S/L :"+sstop+"", Status("pxwidth")/C14+350, Status("pxheight")/C15*5);
GfxSetTextColor( ColorRGB (0,265,0));
GfxTextOut( "Buy TGT 1 : "+BTgt1+"", Status("pxwidth")/C14-350, Status("pxheight")/C15*5);
GfxTextOut( "Buy TGT 6 : "+BTgt6+"", Status("pxwidth")/C14+225, Status("pxheight")/C15*4);
GfxTextOut( "Buy TGT 2 : "+BTgt2+"", Status("pxwidth")/C14-225, Status("pxheight")/C15*4);
GfxTextOut( "Buy TGT 5 : "+BTgt5+"", Status("pxwidth")/C14+125, Status("pxheight")/C15*3);
GfxTextOut( "Buy TGT 3 : "+BTgt3+"", Status("pxwidth")/C14-125, Status("pxheight")/C15*3);
GfxTextOut( "Buy TGT 4 : "+BTgt4+"", Status("pxwidth")/C14, Status("pxheight")/C15*2);
GfxSetTextColor( ColorRGB (265,0,0));
GfxTextOut( "Sell TGT 1 : "+STgt1+"", Status("pxwidth")/C14+350, Status("pxheight")/C15*7);
GfxTextOut( "Sell TGT 6 : "+STgt6+"", Status("pxwidth")/C14-225, Status("pxheight")/C15*8);
GfxTextOut( "Sell TGT 2 : "+STgt2+"", Status("pxwidth")/C14+225, Status("pxheight")/C15*8);
GfxTextOut( "Sell TGT 5 : "+STgt5+"", Status("pxwidth")/C14-125, Status("pxheight")/C15*9);
GfxTextOut( "Sell TGT 3 : "+STgt3+"", Status("pxwidth")/C14+125, Status("pxheight")/C15*9);
GfxTextOut( "Sell TGT 4 : "+STgt4+"", Status("pxwidth")/C14, Status("pxheight")/C15*10);

_SECTION_END();
 
_SECTION_BEGIN("Title");

DODay = TimeFrameGetPrice("O", inDaily);
DHiDay = TimeFrameGetPrice("H", inDaily); 
DLoDay = TimeFrameGetPrice("L", inDaily); 
Title = EncodeColor(colorWhite)+EncodeColor(colorCustom8)+ "|| Sai Stock Broking - 09825340778 || "+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 
;

17 comments

1. cjsheth41

gud morn,

we do not get any value in ur gann sq of 9 so pls do let me know how to go about or modify the same and oblige.

2. vinayak

Sir your AFL is very good.I want to use it for currency trading.Pl tell me what changes we have to do to see values in currency.THANKS FOR USEFUL AFL.

3. mgandhi443

helo sir, no value on this only showing empty please advise how to correct it

regards

4. mukyav

Pls help how to use in commodity.

5. samkum

@cjsheth41……mgandhi443…..mukyav……

please change below given code

RefOpen = ValueWhen(TimeNum() > 092959, Open,1);

BuySignal = TimeNum()>092959 AND Cross(C,babove);
ShortSignal = TimeNum()>092959 AND Cross(Sbelow,C);
6. Divyesh

@ samkum,

thans……!

7. svsoundar

I AM CHANGE THERE BUT NOT WORKING
THANKS
SOUNDAR

8. mukyav

Samkum
Did all as you directed above for commodity.
I changed all three lines as you said but no gain.Empty values.
Pls help.

9. mukyav

Samkum
Did all as you directed above for commodity.
I changed all three lines as you said .
I copy pasted and it is done.
Thanks a lot.

10. samkum

@ mukyav & svsoundar

(For Commodity)
Check ur system time settings:

Control Panel-Regional and Language Options-Customise or Advance -Date-Short Date Format.(may be any according to Win7 or XP)
It should be dd/mm/yyyy.

Amibroker Database settings:

No. of Bars: 30000 to 50000
Base time interval : 1 min

Intraday settings :

check show 24 hrs trading (24 hours) is enabled
trading hours (local time): Start 09:25 End 23:55
Check Allow mixed EOD/Indraday data is enabled

Tools Preferences:

Check time of LAST tick inside bar is enabled
Realtime chart refresh interval [sec] : 1

Copy paste the ABOVE formula..
REPLACE THE LINE 8 with this one

RefOpen = ValueWhen(TimeNum() >= Param(“Time Zone”,092000,092900,100500,8500), Open,1);

REPLACE THE LINE 45, 46

BuySignal = TimeNum()>Param(“Buy Signal @”,092000,092900,100500,8500) AND Cross(C,babove);
ShortSignal = TimeNum()>Param(“Sell Signal @”,092000,092900,100500,8500) AND Cross(Sbelow,C);

Done!
This is my settings for commodity, Its working for me.. :)

11. dineshkummar

HI Guys,

I am using Amibroker 5.6.3, I have copied this afl and try to run nothing coming out only blank screen, I need some one help to run this.

Thanks in Advance,

Dhinesh

12. eevra

Thx Divyesh.
Wonderful..

13. eevra

DineshKumar,

Just keep pressing (-)ZOOMOUT in the amibroker. The chart will pan to visible range

14. passion2trade

Dear All,

I’m using this for stocks.
I’ve settings like this

RefOpen = ValueWhen(TimeNum() > 091500, Open,1);

BuySignal = TimeNum()>091500 AND Cross(C,babove);
ShortSignal = TimeNum()>091500 AND Cross(Sbelow,C);

But all values shows empty, kindly help.

@ Admin plz check this AFL.

15. StockJock

Has anyone been able to get this code to work for stocks? If you did, what changed did you make to the code?

16. ole

What changes are needed to use this code for end-of-day?

17. Dhaval thakkar

helo sir, no value on this only showing empty please advise how to correct it

Leave Comment

Please login here to leave a comment.

Back