Seniors, could you please guide me where I am going wrong in the following afl code:
y = Year();
m = Month();
d = Day();
r=Hour();
e=Minute();
n=Second();
BuyDate=Null;
BuyTime=Null;
SellDate=Null;
SellTime=Null;
for(i=BarCount-1;i>1;i--)
{
if(Buy==1)
{
BuyDate=StrFormat("%02.0f-%02.0f-%02.0f", y[ i ], m[ i ], d[ i ] );
BuyTime=StrFormat("%02.0f:%02.0f:%02.0f", r[ i ],e[ i ],n[ i ] );
bars = i;
i = 0;
}
if( Sell==1)
{
SellDate=StrFormat("%02.0f-%02.0f-%02.0f", d[ i ], m[ i ], y[ i ] );
SellTime=StrFormat("%02.0f:%02.0f:%02.0f", r[ i ],e[ i ],n[ i ] );
bars = i;
i = 0;
}
}
GfxTextOut( " " + WriteIf (Buy, ""+BuyDate, ""), 40, 80 );
The above code gives {EMPTY} when GfxTextOut is used for output.
And :
GfxTextOut( " " + IIf (Buy, BuyDate, Null), 40, 80 );
produces result = 0
Also changing the for statement for loop gives afl error
for(i=0;i<BarCount;i++) gives endless loop error.
Any help will be highly appreciated.
Thanks for your kind assistance.
y = Year();
m = Month();
d = Day();
r=Hour();
e=Minute();
n=Second();
BuyDate=Null;
BuyTime=Null;
SellDate=Null;
SellTime=Null;
for(i=BarCount-1;i>1;i--)
{
if(Buy==1)
{
BuyDate=StrFormat("%02.0f-%02.0f-%02.0f", y[ i ], m[ i ], d[ i ] );
BuyTime=StrFormat("%02.0f:%02.0f:%02.0f", r[ i ],e[ i ],n[ i ] );
bars = i;
i = 0;
}
if( Sell==1)
{
SellDate=StrFormat("%02.0f-%02.0f-%02.0f", d[ i ], m[ i ], y[ i ] );
SellTime=StrFormat("%02.0f:%02.0f:%02.0f", r[ i ],e[ i ],n[ i ] );
bars = i;
i = 0;
}
}
GfxTextOut( " " + WriteIf (Buy, ""+BuyDate, ""), 40, 80 );
The above code gives {EMPTY} when GfxTextOut is used for output.
And :
GfxTextOut( " " + IIf (Buy, BuyDate, Null), 40, 80 );
produces result = 0
Also changing the for statement for loop gives afl error
for(i=0;i<BarCount;i++) gives endless loop error.
Any help will be highly appreciated.
Thanks for your kind assistance.