Asis,
I copy and pasted the afl below into a new afl chart and did not
receive any errors. I tried all parameter variations and still was not
able to replicate the error message you describe.
David K.
--- In amibroker@xxxxxxxxxps.com,
Asis Ghosh <subhamedicalsjpg@...> wrote:
>
> Hello,
>
> I put this AFL --there is some minor error--(not producing any
signal in
> the chart)--ERROR MESSAGE: ERROR-29>>VARIABLE GTEXT BEING
USED WITHOUT
> BEING INITIALIZED
>
> Can any one rectify this error ?
>
> Asis
>
>
> wooziwog wrote:
> >
> >
> > Reinsley,
> >
> > Thanks for the feedback. Replace your copy with the code
below and you
> > will not receive the message. The "Plot Shapes" is for
plotting starts
> > at the Highs and Lows of the various pivots - I have never
used it so
> > I can't be sure that all is right. The error message you
received was
> > due to the fact that the arrays were not turned on when the
plot
> > shapes was turned on. To minimize execution time on my
intraday charts
> > I avoid executing the arrays when the lines or text are not
being
> > used. Now the arrays will also be processed when plot shapes
are
> > turned on. I have not tested the shapes plot yet - it is
supposed to
> > plot stars at the highs and lows of the various time frames.
Let me
> > know how it works :-)
> >
> > David K.
> >
> > //======================
> > _SECTION_BEGIN("Chart Settings");
> > //======================
> > SetChartOptions(0, chartShowDates);
> > SetChartBkColor(1);
> > GraphXSpace=Param("GraphXSpace",15,0,300,1);
> > dec= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
> > bc = BarCount-1;
> > bi = BarIndex();
> > Lbi = LastValue(bi);
> > sbi = SelectedValue(BarIndex());
> > tn = TimeNum();
> > Plot(C,"",IIf(C>O,34,IIf(C<O,32,55)),128,4);
> > //======================
> > pxchartright = Status("pxChartRight");//returns
y-coordinate of
> > top-left corner
> > //======================
> > _SECTION_BEGIN("GFX X Conversion");
> > function tpX(bar) {
> > lvb = Status("LastVisibleBar");
> > fvb = Status("FirstVisibleBar");
> > pxchartleft = Status("pxChartLeft");
> > pxchartright = Status("pxChartRight");
> > pxheight = Status("pxheight");
> > pxchartwidth = Status("pxChartWidth");
> > return pxchartleft+(bar-fvb)*pxchartwidth/(Lvb-fvb+1);
}
> > _SECTION_END();
> > //======================
> > _SECTION_BEGIN("GFX Y Conversion");
> > function tPY(Value) {
> > local Miny, Maxy, pxchartbottom, pxchartheight;
> > Miny = Status("AxisMiny");
> > Maxy = Status("AxisMaxy");
> > pxchartbottom = Status("pxChartBottom");
> > pxchartheight = Status("pxChartHeight");
> > return pxchartbottom - floor(0.5
> > +(Value-Miny)*pxchartheight/(Maxy-Miny)); }
> > _SECTION_END();
> > //======================
> > _SECTION_BEGIN("GFX Text+Label, GFX Y, Std X");
> > //======================
> > dec=0; ha=0;
> > procedure gtx(val,color,string,xpos) {
> > GfxSetTextColor(color);
> > gtext=GfxDrawText(NumToStr(val,dec)+"-"+
> > StrExtract(string,0)+" ",xpos,tpY(SelectedValue(val))+ha,0,0,256);
> > return gtext; }
> > _SECTION_END();
> > //======================
> > _SECTION_BEGIN("Plot Shapes");
> > //======================
> > procedure plshp(x,y,shape,color,shift)
> > { PlotShapes(IIf(BarIndex()==x,shape,0),color,0,y,shift);
}
> > //===========================
> > lls=0; sln=0;
> > procedure hrplt(tf,value,color,sty,shf) {
> > Lin=LineArray(Lbi-lls-shf,LastValue(value),
> > Lbi+shf,LastValue(value),1);
> > Plot(IIf(tf AND sln==0,value,Null),"",color,sty,0,0,shf);
> > Plot(IIf(sln==1,Lin,Null),"",color,sty,0,0,shf);
}
> > //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > //Time and Dates
> > begD = DateNum() != Ref(DateNum(),-1);//Begin New Day
> > fboD = LastValue(ValueWhen(begD,bi,1));//First Bar
of Day
> > endD = DateNum() != Ref(DateNum(), 1);//End of Day
> > lboD = LastValue(ValueWhen(endD,bi,1));//Last Bar
of Day
> > lbpd = LastValue(ValueWhen(begD,bi,2)-1);//Last Bar
of Previous Day
> > tday = DateNum()==LastValue(DateNum(),1);//Includes
current fbod to
> > future lbod
> > pdaz= ValueWhen(begD,Ref(DateNum(),-1),1);//All
bars prior to existing
> > lbod
> > prdaz=pdaz AND NOT tday;
> > notda= NOT tday;
> > //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > _SECTION_BEGIN("Intraday Time Pivots");
> > //===============================
> > ipv = ParamList("Sup Res Pivots","Off|All|Calculate|OHLC|Lines|Labels",3);
> > psh= ParamToggle("Plot Shapes", "Off|On",0);
> > htx = Param("Text Shift",18,-200,150,1);
> > sln= ParamToggle("Short Lines", "Off|On",1);
> > lls = Param("Short Line Length",3,0,500,1)*10;
> > shf = Param("Shift Line Right",2,0,50,1);
> > rsc = ParamToggle("No Rescale","Off|On",1);
> > sty = ParamStyle("Style",4096);
> > optn= Param("Market Open",93000,00000,235959,000500);
> > cltn= Param("Market Close",161500,00000,235959,000500);
> > plsi= Param("Start Plotting",083000,00000,240000,000500);
> > plei= Param("End Plotting",161500,00000,240000,000500);
> > //===================
> > function tvy(tstart,tframe,array) {
> > if(array==1)y = ValueWhen(tframe,HighestSince(Cross(tn,tstart),H),1);
> > if(array==2)y = ValueWhen(tframe,LowestSince(Cross(tn,tstart),L),1);
> > y0=IIf(y>0,y,Null);
> > return y0; }
> > //======================
> > function xbar(tstart,tframe,array) {
> > if(array==1) {
> > y=ValueWhen(tframe,HighestSince(Cross(tn,tstart),H),1);
> > x=BarIndex()==ValueWhen(tframe AND H==y,bi);
> > x0=bc-LastValue(BarsSince(x>0),1); }
> > if(array==2) {
> > y=ValueWhen(tframe,LowestSince(Cross(tn,tstart),L),1);
> > x=bi==ValueWhen(tframe AND L==y,bi);
> > x0=bc-BarsSince(x>0); }
> > return x0; }
> > //==============
> > if(ipv=="All" OR ipv=="Calculate" OR ipv=="Lines" OR
ipv=="Labels" OR
> > ipv=="OHLC" OR psh==1) {
> > pmtn = optn-010000; premkt = tn >= pmtn AND tn <= optn;
> > mk05 = optn+000500; tfrm05 = tn>=optn AND tn<= mk05;
> > mk15 = optn+001500; tfrm15 = tn>=optn AND tn<= mk15;
> > mk30 = optn+003000; tfrm30 = tn>=optn AND tn<= mk30;
> > mk45 = optn+004500; tfrm45 = tn>=optn AND tn<= mk45;
> > mk60 = optn+010000; tfrm60 = tn>=optn AND tn<= mk60;
> > mkss = 110000;
> > mkse = 133000; tfrslo = tn>=mkss AND tn<= mkse;
> > va30 = 154500; tfva30 = tn>=va30 AND tn<= cltn;
> > va2h = cltn-020000; tf2hrs = tn>=va2h AND tn<= cltn;
> > mktHrs = tn>=optn AND tn<= cltn;
> > pltval = tn>=plsi AND tn<= va2h;
> > //======================
> >
> > cyHi = HighestSince(bi==fbod,H);
> > cxHi = ValueWhen(tday AND H==cyHi,bi);
> > cyLo = LowestSince(bi==fbod,L);
> > cxLo = ValueWhen(tday AND L==cyLo,bi);
> > pyHi = ValueWhen(prdaz,HighestSince(bi==lbpd,H),1);
> > pxHi = ValueWhen(H==pyHi AND NOT tday ,bi);
> > pyLo = ValueWhen(prdaz,LowestSince(bi==lbpd,L),1);
> > pxLo = ValueWhen(L==pyLo AND NOT tday,bi);
> > mkOp = ValueWhen(Cross(tn,cltn),O,1);
> > xmOp = bc-BarsSince(Cross(tn,optn)>0);
> > mkCl = ValueWhen(Cross(TimeNum(),160000),C);
> > xmCL = bc-BarsSince(Cross(TimeNum(),160000)>0);
> > xpmk = bc-BarsSince(Cross(tn,optn)>0);
> > //======================
> > poHi=tvy(pmtn,premkt,1); poLo=tvy(pmtn,premkt,2);
> > mkHi=tvy(optn,mktHrs,1); mkLo=tvy(optn,mktHrs,2);
> > Hi05=tvy(optn,tfrm05,1); Lo05=tvy(optn,tfrm05,2);
> > Hi15=tvy(optn,tfrm15,1); Lo15=tvy(optn,tfrm15,2);
> > Hi30=tvy(optn,tfrm30,1); Lo30=tvy(optn,tfrm30,2);
> > Hi60=tvy(optn,tfrm60,1); Lo60=tvy(optn,tfrm60,2);
> > vH2h=tvy(va2h,tf2hrs,1); vL2h=tvy(va2h,tf2hrs,2);
> > vH30=tvy(va30,tfva30,1); vL30=tvy(va30,tfva30,2);
> > ACDos = (Hi15- Lo15) * 0.50;
> > ACDHi=Hi15+ACDos; ACDLo=Lo15-ACDos;
> > dRange = cyHi - cyLo;
> > mRange = mkHi - mkLo;
> > }
> > //===================
> > sty1=8|sty|rsc*2048; sty2=32|sty|rsc*2048;
> > tfplt = TimeNum()>=plsi AND TimeNum()<=plei;
> > if(ipv=="All" OR ipv=="Lines" OR ipv=="OHLC") {
> > hrplt(tfplt,mkOp,29,sty1,shf); hrplt(tfplt,mkCl,55,sty1,shf);
> > hrplt(tfplt,poHi,10,sty1,shf); hrplt(tfplt,poLo,10,sty1,shf);
> > hrplt(tfplt,mkHi,32,sty1,shf); hrplt(tfplt,mkLo,34,sty1,shf);