Try the code below. It works for me most of the
time ... Sometimes it gives a - (negative) value for a short period of time ...
hope you can improve on it.
//
****************************************************************************
// Compute Time Left In Bar //
BarTime1 =
LastValue(TimeNum()-Now(4)); DataError = iif(Now(4) >
TimeNum(),True,False); TimeBase =
iif(Interval(1)>0,1,0);
_N(StrBarTime =
NumToStr(BarTime1,1.0,False)); BT_Length =
StrLen(StrBarTime); _N(BarTime2 =
writeif(BT_Length>4,StrRight(StrBarTime,4),StrBarTime));
/* _N(BarTime =
Writeif(BT_Length==1,"0:0"+StrBarTime,Writeif(BT_Length==2,"0:"+StrBarTime,
Writeif(BT_Length==3,StrLeft(StrBarTime,1)+":"+StrRight(StrBarTime,2),
StrLeft(StrBarTime,2)+":"+StrRight(StrBarTime,2))))); */ _N(BarTime2
=
Writeif(BT_Length==1,"0:0"+BarTime2,Writeif(BT_Length==2,"0:"+BarTime2,
Writeif(BT_Length==3,StrLeft(BarTime2,1)+":"+StrRight(BarTime2,2),
StrLeft(BarTime2,2)+":"+StrRight(BarTime2,2)))));
_N(TimeLeft =
Writeif(TimeBase==0,"N/A",BarTime2)); _N("timenum " +
Writeval(Timenum(),1.0)); _N("Now
" + Writeval(Now(4),1.0)); //"time left " +
Writeval(BarTime1,1.0); _N("time left2 " +
BarTime2); //
****************************************************************************
----- Original Message -----
Sent: Friday, September 09, 2005 3:48
PM
Subject: [amibroker] Countdown
timer
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
YAHOO! GROUPS LINKS
|