Can u warning correct in afl

#1
hi,

ami v 5.91.1 and up displays this warning
can any one correct the warning problem in this afl.
Afl works .
but when u do Tools -->Apply indicator it displays warning

ty for looking

Afl name is Super VSP

In amibroker 6 it displays message




Code:
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 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );


_SECTION_BEGIN("VWAP");
 
Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == 090000, BarIndex());
TodayVolume = Sum(V,Bars_so_far_today);
IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today ) /
TodayVolume,0);
Plot (VWAP,"VWAP",colorGreen, styleThick);
_SECTION_END();
 

_SECTION_BEGIN("ATP");

DayChange = Day() != Ref(Day(), -1);
AvgTradePrice = Null;
CurDayBars = 0;
CurDayCloseSum = 0;
 
for (i = 0; i < BarCount; i++)
{
if (DayChange[i])
{
CurDayCloseSum = C[i];
CurDayBars = 1;
}
else
{
CurDayCloseSum = CurDayCloseSum + C[i];
CurDayBars++;
}
AvgTradePrice[i] = CurDayCloseSum / CurDayBars;
}
Plot(AvgTradePrice, "AvgTradePrice",colorRed,styleThick);
ATP=AvgTradePrice;
 
_SECTION_END();

Buy  =Cover=Ref(L,-1)>Ref(VWAP,-1) AND Ref(L,-1)>Ref(AvgTradePrice,-1)AND H>Ref(H,-1);
Short=Sell=Ref(AvgTradePrice,-1)>Ref(H,-1) AND Ref(VWAP,-1)>Ref(H,-1)AND L<Ref(L,-1);


Buy=ExRem(Buy,Short) OR ExRem(Buy,Sell) ;
Short=ExRem(Short,Buy) OR ExRem(Short,Cover);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);


PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-45);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-55); 
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-50); 
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=55);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=65); 
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-60);

_SECTION_BEGIN("ema");
Lk = EMA(Close,22);



GfxSetOverlayMode(0); 
GfxSelectFont("Tahoma", Status("pxheight")/36); 
GfxSetTextAlign( 6 );// center alignment 
GfxSetTextColor( colorLightGrey ); 
GfxSetBkMode(0); // transparent 
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/15 );

cx=Param("cxposn",785,0,500,1);
cy=Param("cyposn",39,0,500,1);
GfxSetBkColor(ColorRGB(200,50,100));
GfxSelectFont( "tohomabold",24,30, False);
GfxSetTextColor( colorYellow);
GfxSetTextColor( ColorHSB( 100, 10, 400) );
GfxTextOut("LTP. "+C+" ", cx, cy );

_SECTION_END();
 
Last edited:

vijkris

Learner and Follower
#2
hi,
can any one correct the warning problem in this afl.
Afl works .
but when u do Tools -->Apply indicator it displays warning

ty for looking

Afl name is Super VSP

Code:
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 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );


_SECTION_BEGIN("VWAP");
 
Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == 090000, BarIndex());
TodayVolume = Sum(V,Bars_so_far_today);
IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today ) /
TodayVolume,0);
Plot (VWAP,"VWAP",colorGreen, styleThick);
_SECTION_END();
 

_SECTION_BEGIN("ATP");

DayChange = Day() != Ref(Day(), -1);
AvgTradePrice = Null;
CurDayBars = 0;
CurDayCloseSum = 0;
 
for (i = 0; i < BarCount; i++)
{
if (DayChange[i])
{
CurDayCloseSum = C[i];
CurDayBars = 1;
}
else
{
CurDayCloseSum = CurDayCloseSum + C[i];
CurDayBars++;
}
AvgTradePrice[i] = CurDayCloseSum / CurDayBars;
}
Plot(AvgTradePrice, "AvgTradePrice",colorRed,styleThick);
ATP=AvgTradePrice;
 
_SECTION_END();

Buy  =Cover=Ref(L,-1)>Ref(VWAP,-1) AND Ref(L,-1)>Ref(AvgTradePrice,-1)AND H>Ref(H,-1);
Short=Sell=Ref(AvgTradePrice,-1)>Ref(H,-1) AND Ref(VWAP,-1)>Ref(H,-1)AND L<Ref(L,-1);


Buy=ExRem(Buy,Short) OR ExRem(Buy,Sell) ;
Short=ExRem(Short,Buy) OR ExRem(Short,Cover);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);


PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-45);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-55); 
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-50); 
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=55);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=65); 
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-60);

_SECTION_BEGIN("ema");
Lk = EMA(Close,22);



GfxSetOverlayMode(0); 
GfxSelectFont("Tahoma", Status("pxheight")/36); 
GfxSetTextAlign( 6 );// center alignment 
GfxSetTextColor( colorLightGrey ); 
GfxSetBkMode(0); // transparent 
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/15 );

cx=Param("cxposn",785,0,500,1);
cy=Param("cyposn",39,0,500,1);
GfxSetBkColor(ColorRGB(200,50,100));
GfxSelectFont( "tohomabold",24,30, False);
GfxSetTextColor( colorYellow);
GfxSetTextColor( ColorHSB( 100, 10, 400) );
GfxTextOut("LTP. "+C+" ", cx, cy );

_SECTION_END();
no errors/warnings displayed...
 

vijkris

Learner and Follower
#6
No Bro, at lunch log in to TJ, how are you? Hope having nice time trading.:thumb::thumb::thumb:
ya.. am fine.. paper trading z progressing well. :rofl:
 

trash

Well-Known Member
#9
Allright i think amibroker 5.91.1 and up wil get this warning
ok.. amibroker 6 sucks then .. in amibroker 6 it displays warning message
You are just an incompetent software pirate a always. Not paying for quality work but writing nonsense all other the place.

If you have no clue then just stay quiet or at least finally buy the software first since legal authorities are already catching up on you.

The whole line #11 is complete bollocks.
You should read basic coding mistakes in AB manual.

Then you would see that it is wrong to handle IIf() function the way you do

Corrected line
Code:
bi = Barindex();
mysum = Sum (C * V, Bars_so_far_today ) / (TodayVolume[B][COLOR="Red"] + 1e-30[/COLOR][/B]);
[B][COLOR="Red"]VWAP =[/COLOR][/B] IIf(bi >= StartBar, mysum,0);
PS: YOU are the one who sucks

You should possibly read development log once in a while too.
http://www.amibroker.com/devlog/index.php?s=5.91

3. AFL: added “Warning 505. Division by zero” (level 2 warning). It detects divison by zero in arrays too and prints which array element was zero
 
Last edited:
#10
@KelivinHand

i tried chaning it to
IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today ) /TodayVolume,Null);
i don;t know that deep programming............
so didn;t gave desirable result

@TRASH
ty for corrected code but it turned off all the buy sell arrow so that won:t work>>
[the code ] kills all the buy sell arrows so not desirable solution
_SECTION_BEGIN("VWAP");

Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == 090000, BarIndex());
TodayVolume = Sum(V,Bars_so_far_today);


//IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today ) / TodayVolume,o);

bi = Barindex();
mysum = Sum (C * V, Bars_so_far_today ) / (TodayVolume + 1e-30);
VWAP = IIf(bi >= StartBar, mysum,0);

Plot (VWAP,"VWAP",colorGreen, styleThick);
_SECTION_END();
and it really does:t matter i live in small box ,in a cornner so yea catch me if u can .Beside you should tell coders to make there code more secure .
like they say " don;t hate hacker Hate the code".
I am done . and that discussion is pointless so that topic is closed for discussion
IF freedom is outlawed only outlawed will have freedom --->yup quote comes from same group that was
able to patch it :xD

I do suck and i suck candy and love it.. but ppls at amibroker suck something else that might look like my banana haha
 
Last edited:

Similar threads