I want to ask to the ravjiri that said that he modified the original formula, where is the original. becuase i want to use it on nasdaq and i don't know if now the formula is good for this market.
Nothing much changed in the origional AFL, I lost the origional but below is almost same. I modified only buy sell and profit booking conditions
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates,colorRed);
Plot(C,"Price",IIf(C>O,colorBrightGreen,colorBrown),styleCandle);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}
_SECTION_END();
_SECTION_BEGIN("GaNN Square of Nine");
BarsToday = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == 091500, BarIndex());
TodayVolume = Sum(V,BarsToday);
VWAP = (Sum (((C+O+H+L)/4) * V, BarsToday ) / TodayVolume);
RefVWAP = ValueWhen(TimeNum() == 092900, C,1);
Plot (VWAP,"VWAP",colorBlue, styleStaircase = 512 );
BaseNum = (int(sqrt(RefVWAP))-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)< RefVWAP, i, sBelowI);
bAboveI = sBelowI + 1;
sBelow = VarGet("GANN"+sBelowI);
bAbove = VarGet("GANN"+bAboveI);
}
BuySignal = H > bAbove AND TimeNum() > 092900;
ShortSignal = L < sBelow AND TimeNum() > 092900;
BuySignal = ExRem(BuySignal,ShortSignal);
ShortSignal = ExRem(ShortSignal,BuySignal);
BuyProfitStop = H > (0.995 * VarGet("Gann"+(bAboveI+1)));
ShortProfitStop = L < (1.005 * VarGet("Gann"+(sBelowI-1)));
SetOption("MaxOpenPositions", 1 );
SetPositionSize(100,spsShares);
Buy = BuySignal;
Sell = ShortSignal OR BuyProfitStop;
Short = ShortSignal;
Cover = BuySignal OR ShortProfitStop;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short = ExRem(Short,Cover);
Cover = ExRem(Cover,Short);
ByStat = Flip(Buy,Sell);
ShStat = Flip(Short,Cover);
// 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));
// 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));
GfxSetBkMode( 1 );
GfxSelectFont("Courier New", 9, 700 );
GfxSetTextColor( colorRed );
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorWhite );
BTgtext = "Buy Targets : " + NumToStr(btgt1,1.2,False) + " - " + NumToStr(btgt2,1.2,False) + " - " + NumToStr(btgt3,1.2,False);
STgtext = "Short Targets : " + NumToStr(stgt1,1.2,False) + " - " + NumToStr(stgt2,1.2) + " - " + NumToStr(stgt3,1.2,False);
GfxTextOut("Current time : " + TimeNum(), 625, 25);
GfxTextOut("Buy Above : " + WriteIf(TimeNum()>092900, NumToStr(bAbove,1.2,False) + " SL : " + NumToStr(sBelow,1.2,False),"Waiting for Signal"), 625, 45);
GfxTextOut(WriteIf(TimeNum()>092900,BTgtext,""), 625, 55);
GfxTextOut("Short Below : " + WriteIf(TimeNum()>092900, NumToStr(sBelow,1.2,False) + " SL : " + NumToStr(bAbove,1.2,False),"Waiting for Signal"), 625, 75);
GfxTextOut(WriteIf(TimeNum()>092900,STgtext,""), 625, 85);
_SECTION_END();
PlotOHLC( babove, sbelow, babove,sbelow, "", ColorRGB(255,255,128), styleCloud);
PlotOHLC( sbelow, babove, sbelow,babove, "", colorYellow, styleCloud); SetChartOptions(0,chartShowArrows|chartShowDates);
Plot(BTgt1,"",colorGreen,styleStaircase|styleSwingDots|styleNoRescale);
Plot(BTgt2,"",colorGreen,styleStaircase|styleSwingDots|styleNoRescale);
Plot(BTgt3,"",colorGreen,styleStaircase|styleSwingDots|styleNoRescale);
Plot(STgt1,"",colorRed,styleStaircase|styleSwingDots|styleNoRescale);
Plot(STgt2,"",colorRed,styleStaircase|styleSwingDots|styleNoRescale);
Plot(STgt3,"",colorRed,styleStaircase|styleSwingDots|styleNoRescale);