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

[amibroker] Re: Testing for new bar using string manipulation and quotation time



PureBytes Links

Trading Reference Links

What is your point Herman? I use RequestTimedRefresh(1) in the program I traced to determine when TimeNum changed. TimeNum changed when the first tick arrived, as I stated, regardless of the actual time of day. The following trace statement shows TimeNum did not change until 4 seconds into the new bar. Earlier today before the market opened TimeNum did not change until 20 seconds into the new bar.

4939 10:26:04 AM [184] #, Main, BarCtrl, NewBar = True, OldBarTime = 102500, NewBarTime = 102600

This is the code I use to test for a new bar

// Check if new bar
OldBarTime = StaticVarGet(VarPfx + "BarTime");
NewBarTime = LastValue(TimeNum());
if(	 OldBarTime != NewBarTime )
	NewBar = True;
else
	NewBar = False;
if(DebugOn) _TRACE("#, Main, BarCtrl" + WriteIf(newBar, ", NewBar =   True", ", NewBar = False") + ", OldBarTime = " + NumToStr(OldBarTime, 1, False) + ", NewBarTime = " + NumToStr(NewBarTime , 1, False) );
StaticVarSet(VarPfx + "BarTime", LastValue(TimeNum()));

I set the static var BarTime to LastValue(TimeNum())in my init routine to prevent signaling a new bar in the middle of a bar. It will not signal a new bar until the next bar starts.

Barry




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

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