[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Countdown timer



PureBytes Links

Trading Reference Links

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 -----
From: mymail
Sent: Friday, September 09, 2005 3:48 PM
Subject: [amibroker] Countdown timer

 
Hello All,
 
I am trying to get a countdown timer for intraday trading. In other words, a timer that will count down the interval time to 0 whenever an interval bar changes. So that if my interval is 3 minutes, as soon as a bar changes it will count down the 180 seconds, to show me how long I have left until a bar prints again.
 
Anyone have some code to share to do this?
 
Thank you
Tom
 


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