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

[amibroker] Re: Time left in bar



PureBytes Links

Trading Reference Links

Hi,

Any one test Ara code?


//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);





--- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@xxx> wrote:
>
> 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);
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/