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

[amibroker] Re: Time left in bar



PureBytes Links

Trading Reference Links

Many thanx jeff - that worked.



Dean H,

--- In amibroker@xxxxxxxxxxxxxxx, "Jeff" <jeffstr@xxxx> wrote:
> Dean,
> The function returns a value, try;
> 
> Title = CountDownTimer();
> 
> --jeff
> 
>   -----Original Message-----
>   From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
On
> Behalf Of troll
>   Sent: Friday, September 23, 2005 11:33 AM
>   To: amibroker@xxxxxxxxxxxxxxx
>   Subject: [amibroker] Re: Time left in bar
> 
> 
> 
>   Nice code hoolee - I've tried adding but keep getting error
>   indicating 'timercode' used without being initialized.
> 
>   This is the line I tried (and other variations):
> 
>   Title = timercode= EncodeColor(colorBlack) + "  Timer: " + 
timercode;
> 
>   Not sure where I'm going wrong here. I thought function 
initialized
>   timercode variable for use in title line.
> 
>   Thanks & Regards,
> 
>   Dean H.
> 
> 
> 
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "hoolee0820" <hoolee0820@xxxx>
>   wrote:
>   > Jeff, What Alex provided was an attachment of some other timer
>   > program. The code included in your function was actually 
written by
>   > me, please give me credit, hahaha...
>   >
>   > HL
>   >
>   >
>   > --- In amibroker@xxxxxxxxxxxxxxx, "Jeff" <jeffstr@xxxx> wrote:
>   > > Hi Ara.   Awhile back, Alex Dolaptchiev posted some code.
>   > > Alex, if your reading this, thanks!!!!
>   > >
>   > > This is my modified version, setting is Start Time Of
>   > > Interval.    Works good, I just add the function in the
>   > > my title statements.
>   > >
>   > > function CountDownTimer( )
>   > >    {
>   > >    //  CountDown Timer
>   > >    thisbar = TimeNum();
>   > >    nextbar = thisbar+(Interval()/60*100);
>   > >    systime = Now(4); //pt time zone
>   > >    systime = IIf(systime>=240000,systime-240000,systime);
>   > >    anewbar = nextbar-systime-40;
>   > >    anewbar = IIf(anewbar<0,0,anewbar );
>   > >    nnewbar = LastValue(anewbar);
>   > >
>   > >    if (nnewbar > 20) timercode = EncodeColor(colorBlue);
>   > >    else timercode = EncodeColor(colorRed);
>   > >
>   > >    anewbar= NumToStr(anewbar,1,False);
>   > >    length=StrLen(anewbar);
>   > >
>   > >    if (length== 1) timercode=timercode + "00:0" + anewbar;
>   > >    else if (length== 2) timercode=timercode +  "00:" + 
anewbar;
>   > >    else if (length== 3) timercode= timercode +  "0"+ StrLeft(
>   > anewbar, 1) +
>   > > ":" + StrRight( anewbar, 2) ;
>   > >    else if (length== 4) timercode= timercode +  StrLeft( 
anewbar,
>   > 2) + ":" +
>   > > StrRight( anewbar, 2) ;
>   > >    else timercode=timercode +  "00:00";
>   > >
>   > >    timercode= EncodeColor(colorBlack) + "  Timer: " + 
timercode;
>   > >    return timercode;
>   > >    }
>   > >
>   > > --jeff
>   > >
>   > >  -----Original Message-----
>   > > From: amibroker@xxxxxxxxxxxxxxx 
[mailto:amibroker@xxxxxxxxxxxxxxx]
>   > On Behalf
>   > > Of Ara Kaloustian
>   > > Sent: Thursday, September 22, 2005 3:02 PM
>   > > To: AB-Main
>   > > Subject: [amibroker] Time left in bar
>   > >
>   > >
>   > >   Recently I posted my "imperfect" code... someone else posted
>   code
>   > for same
>   > > function... both seem to have similar problems.
>   > >
>   > >   I reviewed my code and reduced it to basics.
>   > >
>   > >   Design Concept:  TimeLeftinBar = TimeNum() - Now(4);
>   > >
>   > >   If time numbet() is set to display the end of bar time, 
then Now
>   > (4) will
>   > > always be less the TimeNum() by an amount equal to time left.
>   > >
>   > >   Problem:  Time returned by Now(4) is sometimes greater the
>   TimeNum
>   > (),
>   > > sometime by a significant amount. It seems that new bars are 
not
>   > created at
>   > > the transition of minute bars.
>   > >
>   > >   Would someone test the code below to verify my results. 
Should
>   be
>   > tested
>   > > when RT data is flowing in.  All data will appear in title.
>   > >
>   > >   Thanks
>   > >
>   > >   Ara
>   > >
>   > >   //File: Time Left in Bar
>   > >
>   > >
>   > >
>   > >   PlotOHLC(Open,High,Low,Close,"",colorBlack,styleCandle);
>   > >
>   > >   BarTime1 = (LastValue(TimeNum() - Now(4)));
>   > >
>   > >   _N(TimeBase = Interval(2));
>   > >
>   > >
>   > >
>   > >   _N(StrBarTime = NumToStr(BarTime1,1.0,False));
>   > >
>   > >   BT_Length = StrLen(StrBarTime);
>   > >
>   > >   //Format time left for display
>   > >
>   > >   _N(TimeLeft =
>   > > 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(Title = "Time Left Test - Interval: " + TimeBase + "
>   > TimeNum: " +
>   > > WriteVal(TimeNum(),1.0)
>   > >
>   > >   + " Now: " + Now(4) + " TimeLeft: " + TimeLeft);
>   > >
>   > >
>   > >
>   > >   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
>   > >
>   > >
>   > >
>   > >
>   > >
>   > >   SPONSORED LINKS Investment management software  Real estate
>   > investment
>   > > software  Investment property software
>   > >         Software support  Real estate investment analysis 
software
>   > > Investment software
>   > >
>   > >
>   > > --------------------------------------------------------------
----
>   --
>   > --------
>   > > --
>   > >   YAHOO! GROUPS LINKS
>   > >
>   > >     a..  Visit your group "amibroker" on the web.
>   > >
>   > >     b..  To unsubscribe from this group, send an email to:
>   > >      amibroker-unsubscribe@xxxxxxxxxxxxxxx
>   > >
>   > >     c..  Your use of Yahoo! Groups is subject to the Yahoo! 
Terms
>   of
>   > > Service.
>   > >
>   > >
>   > > --------------------------------------------------------------
----
>   --
>   > --------
>   > > --
> 
> 
> 
> 
>   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
> 
> 
> 
> 
> 
>   SPONSORED LINKS Investment management software  Real estate 
investment
> software  Investment property software
>         Software support  Real estate investment analysis software
> Investment software
> 
> 
> --------------------------------------------------------------------
--------
> --
>   YAHOO! GROUPS LINKS
> 
>     a..  Visit your group "amibroker" on the web.
> 
>     b..  To unsubscribe from this group, send an email to:
>      amibroker-unsubscribe@xxxxxxxxxxxxxxx
> 
>     c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
> 
> 
> --------------------------------------------------------------------
--------
> --




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/