NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Miscellaneous Support > Historical Version 7 Beta Threads > Version 7 Beta General Questions & Bug Reports

Version 7 Beta General Questions & Bug Reports Ask questions here and post bug reports.

 
 
Thread Tools Display Modes
Old 06-07-2010, 01:33 PM   #1
miker
Senior Member
 
Join Date: Mar 2009
Location: Hopkinton MA
Posts: 110
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to miker
Question Bars.Session.GetNextBeginEnd Problem?

Does this method work correctly? Session template is set to 24x7

DateTime sessionBegin,sessionEnd;

if (Bars.SessionBreak)
{
Print("SessionBreak Bar: "+CurrentBar);
Print("Bars.BarsSinceSession: "+Bars.BarsSinceSession);
PrintTrace("DateTime of SessionBreak Bar: "+Time[0]);
Bars.Session.GetNextBeginEnd(Time[0], out sessionBegin, out sessionEnd);
Print("Next sessionBegin: "+sessionBegin);
Print("Next sessionEnd: "+sessionEnd);
}

RESULTS IN FOLLOWING OUTPUT:

SessionBreak Bar: 0
Bars.BarsSinceSession: 0
DateTime of SessionBreak Bar: 6/4/2010 12:20:21 AM
Next sessionBegin: 6/4/2010 12:00:00 AM
Next sessionEnd: 6/5/2010 12:00:00 AM

Why would sessionBegin for GetNextBeginEnd be the "current" session begin time?
miker is offline  
Old 06-07-2010, 02:40 PM   #2
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

Thank you for your forum post.

This is working as expected. As it is 12:00 AM of the next day; NinjaTrader regards a 24 hour chart as being from 12:00 AM on day 1 to 12:00 AM. Since the begin time is the same as the end time they are paired to create a continous chart.

In this case, the next one coming up would be the end of the 6/4 session which is 6/5 12:00AM. The begin returned is the begin of the same session of the end. So the two are always paired for the same session definition.

So to explain this a bit better. This method returns the next SessionBegin or SessionEnd time that is coming next and then pairs with what it found. So if you needed the next session begin end time you would need to call this on the last bar of the session as then the method will return the next session Begin Time since this the next Session Time.

Let me know if I can be of further assistance.
NinjaTrader_Brett is offline  
Old 06-07-2010, 04:19 PM   #3
miker
Senior Member
 
Join Date: Mar 2009
Location: Hopkinton MA
Posts: 110
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to miker
Default

I guess I shouldn't be interpreting the word NEXT so literally. If the current datetime of the session I'm looking at is 6/4/2010 12:20:21 AM, I don't understand why you would not return 6/5/2010 12:00:00 AM as the NEXT SESSION BEGIN DATETIME.
miker is offline  
Old 06-07-2010, 04:30 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

If you want the next session begin pass in a DateTime that would have that as a valid return for the time specified.

Bars.Session.GetNextBeginEnd(Time[0].AddDays(1), out sessionBegin, out sessionEnd)
NinjaTrader_Josh is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
End of session BaRs problem/Residual ticks david111 Version 7 Beta General Questions & Bug Reports 3 04-15-2010 09:08 AM
Number of bars of a session pespinar General Programming 1 03-16-2010 04:09 AM
First Bar of Session/ referring to bars during session mefTrader General Programming 2 01-07-2010 09:51 AM
Add a second instrument to strategy with day session (regular session) only bars net4walk Strategy Development 11 12-27-2009 10:20 PM
Bars.Session.InSession() bi9foot Indicator Development 1 02-03-2008 09:43 PM


All times are GMT -6. The time now is 04:23 PM.