![]() |
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
|
|||||||
| Version 7 Beta General Questions & Bug Reports Ask questions here and post bug reports. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
|
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? |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
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.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
|
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.
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
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)
Josh
NinjaTrader Customer Service |
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
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 |