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 11-14-2010, 06:04 AM   #1
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 333
Thanks: 2
Thanked 12 times in 7 posts
Default Problems with ticks happening at session EndTime

Suppose I use the Default 24/7 session template.

It means that I have session times :
HTML Code:
                           StartTime                             EndTime
Session 1       25/10/2010 06:00:00            26/10/2010 06:00:00
Session 2       26/10/2010 06:00:00            27/10/2010 06:00:00
etc
Problem is that if I call GetNextBeginEnd(26/10/2010 06:00:00, BeginTime,EndTime)

I get
BeginTime=25/10/2010 06:00:00
EndTime=26/10/2010 06:00:00

Where I think the correct answer is
BeginTime=26/10/2010 06:00:00
EndTime=27/10/2010 06:00:00

The tick happening at 26/10/2010 06:00:00 should actually first tick of 26/10 session, not last tick of 25/10 session, meaning EndTime in session templates should be excluded from the session times.


The same kind of problems happens with Volume[0].
I have session data on the ES that has a tick of volume 1 happening exactly at 06:00:00

For testing purposes I made an indicator that cumulated volume of the day
PHP Code:
        protected override void Initialize()
        {
            
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line"CumVol"));
            
Overlay                false;
            Print(
" ");
            Print(
BarsPeriod.Id+" "BarsPeriod.Value);
        }

        
/// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        
protected override void OnBarUpdate()
        {
            
// Use this method for calculating your indicator values. Assign a value to each
            // plot below by replacing 'Close[0]' with your own formula.
            

            
            
if (Bars.FirstBarOfSession)
            {
                if (
CurrentBar>0)
                    Print(
Time[1]+" "+cumvol);
                    
                
cumvol=0;
            }
            
            
cumvol += (int)Volume[0];
            
CumVol.Set(cumvol);

        } 
On second charts, the volume sum of the day should always be constant, but choosing different values of second interval gives different sum of volume : sometimes the tick at 06:00 is included, sometimes it is not
(session in question is the last one: volume is either 1757247 either 1757246)
Quote:
Second 22
10/11/2010 05:59:54 2323115
11/11/2010 05:59:54 2514853
12/11/2010 06:00:00 1757247

Second 26
10/11/2010 05:59:58 2323115
11/11/2010 05:59:58 2514853
12/11/2010 05:59:58 1757247

Second 34
10/11/2010 05:59:54 2323115
11/11/2010 05:59:54 2514853
12/11/2010 06:00:00 1757247

Second 38
09/11/2010 06:00:00 3
10/11/2010 06:00:00 2323115
11/11/2010 06:00:00 2514853
12/11/2010 06:00:00 1757246

Second 39
10/11/2010 06:00:00 2323115
11/11/2010 06:00:00 2514853
12/11/2010 06:00:00 1757247

Second 30
09/11/2010 06:00:00 3
10/11/2010 06:00:00 2323115
11/11/2010 06:00:00 2514853
12/11/2010 06:00:00 1757246

Second 15
10/11/2010 06:00:00 2323115
11/11/2010 06:00:00 2514853
12/11/2010 06:00:00 1757247

Second 20
10/11/2010 06:00:00 2323115
11/11/2010 06:00:00 2514853
12/11/2010 06:00:00 1757247

Second 10
10/11/2010 05:59:50 2323115
11/11/2010 06:00:00 2514853
12/11/2010 06:00:00 1757247

Second 32
09/11/2010 06:00:00 3
10/11/2010 06:00:00 2323115
11/11/2010 06:00:00 2514853
12/11/2010 06:00:00 1757246
gomifromparis is offline  
Old 11-15-2010, 04:59 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
Default

gomi, sorry for our late reply here - we'll look into matters and get back to you.
NinjaTrader_Bertrand is offline  
Old 11-15-2010, 09:49 AM   #3
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
Default

gomi, when would you call your GetNextSessionBeginEnd? I tried a call at session break on ES 1 tick and see this output, whicb would be expected -

11/15/2010 12:00:01 AM Session Start: 11/15/2010 12:00:00 AM Session End: 11/16/2010 12:00:00 AM
NinjaTrader_Bertrand is offline  
Old 11-15-2010, 09:56 AM   #4
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 333
Thanks: 2
Thanked 12 times in 7 posts
Default

Yes, but you tried 12:00:01, not 12:00:00
gomifromparis is offline  
Old 11-15-2010, 09:57 AM   #5
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
Default

That would not be the session break then, the new bar starts as the closing tick of the last is received - this is the 12:00:01 tick here - opening tick of the new session.
NinjaTrader_Bertrand is offline  
Old 11-15-2010, 10:08 AM   #6
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 333
Thanks: 2
Thanked 12 times in 7 posts
Default

If I have session start at 8:30:00 for CME for instance, I will have lots of ticks at the open , which is at the 8:30:00 second. These ticks during the whole 00 second belong to the new session, don't they ?
gomifromparis is offline  
Old 11-15-2010, 10:49 AM   #7
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
Default

NinjaTrader stamps the bar at their close, thus you would need to set the session to begin at 8:29:59 to also use the first closed tick bar in your new session (the 8:30:00 closed one).
NinjaTrader_Bertrand is offline  
Old 11-15-2010, 11:31 AM   #8
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 333
Thanks: 2
Thanked 12 times in 7 posts
Default

????? Sorry, this is not how ninja works.....

I made a quick indicator showing ticks and bar volumes with their timestamps
HTML Code:
         protected override void OnBarUpdate()
        {
            // Use this method for calculating your indicator values. Assign a value to each
            // plot below by replacing 'Close[0]' with your own formula.
        
        if ((FirstTickOfBar) && (CurrentBar>1))
            Print("BAR : "+Time[1]+ " "+Volume[1]);

        }

        protected override void OnMarketData(MarketDataEventArgs e)
        {
            if (e.MarketDataType==MarketDataType.Last)
                Print("Tick : "+e.Time+" "+e.Volume);
        }
I follow ES using instrument defaults, so session start is 15:30:00 Paris time.
Here are the results:

Tick : 27/10/2010 15:29:59 7
Tick : 27/10/2010 15:30:00 1
BAR : 26/10/2010 22:14:59 18
Tick : 27/10/2010 15:30:00 34
Tick : 27/10/2010 15:30:00 22
Tick : 27/10/2010 15:30:00 435
Tick : 27/10/2010 15:30:00 1
Tick : 27/10/2010 15:30:00 2
.
.
.
.

Tick : 27/10/2010 15:30:00 4
Tick : 27/10/2010 15:30:00 1
Tick : 27/10/2010 15:30:00 50
Tick : 27/10/2010 15:30:00 4
Tick : 27/10/2010 15:30:00 200
Tick : 27/10/2010 15:30:01 250
BAR : 27/10/2010 15:30:00 2797
Tick : 27/10/2010 15:30:01 25
Tick : 27/10/2010 15:30:01 16


So as you can see the 15:30:00 ticks are used, no need to use a 15:29:59 session start time....
gomifromparis is offline  
Old 11-15-2010, 02:34 PM   #9
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

Unfortunately I am not following you. The bars are most definitely timestamped with the closing timestamp of the bar. If it is a tick based bar then it will be the timestamp of the last tick in that bar. If it is a time based bar then it will be whatever ending timestamp of that time frame would be.
NinjaTrader_Josh is offline  
Old 11-15-2010, 02:54 PM   #10
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 333
Thanks: 2
Thanked 12 times in 7 posts
Default

This subject has moved to timestamping of the bar but it is totally irrelevant to my issue.

Reread first post : I am only stating that if session begin time==session end time, 06:00:00 for instance, the GetNextBeginEnd has to choose if the tick is in last bar of previous session or first bar of next session.

It chooses to decide it belongs to the last bar of previous session which is not logical, because if Begin Time != End Session, like 8:30:00 and 15:00:00, the 8:30:00 tick is included in the session and the 15:00:00 tick is excluded (last tick of session is 14:59:59)

So Begin Time should be considered inclusive, and End Time exclusive, which mean the 06:00:00 tick we mentioned should be first tick of next session

Which means GetNextBeginEnd (10/10/2010 06:00:00) should give
Begin Time=10/10 End Time 11/10 and not
Begin Time=9/10 End Time 10/10

like it does today
gomifromparis is offline  
Old 11-15-2010, 03:57 PM   #11
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

Code:
FirstBarOfSession Time: 11/15/2010 6:01:00 AM Session Start: 11/15/2010 6:00:00 AM Session End: 11/16/2010 6:00:00 AM
PC clock set to GMT+1.
First bar of the session is timestamped as 6:01AM which is the end timestamp of a 1min bar equivalent to what my chart is using. Now we check out GetNextBeginEnd, providing me accurate 11/15 to 11/16.

Running off a 150-tick chart now...
Code:
FirstBarOfSessionTime: 11/15/2010 6:09:32 AM Session Start: 11/15/2010 6:00:00 AM Session End: 11/16/2010 6:00:00 AM
The exact timestamp of 6:00:00AM belongs to the prior session. Data with timestamp later than 6AM belongs to the new session.
NinjaTrader_Josh is offline  
Old 11-15-2010, 04:17 PM   #12
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 333
Thanks: 2
Thanked 12 times in 7 posts
Default

Quote:
Originally Posted by NinjaTrader_Josh View Post
The exact timestamp of 6:00:00AM belongs to the prior session
Yes, I know, this is my very point. Does it seem logical to you ?

Imagine the flow of the ticks with a millisecond granularity.

If we set start/end session at 06:00:00, we will get with your solution all the ticks from
06:00:01.000 to next day 06:00:999

If you decide to include begin time and exclude end time, we will get all ticks from
06:00:00.000 to next day 05.59.999, which seems much more what we are willing to do when we set start/end session at 06:00:00 ...

Or maybe is it "by design" ?
gomifromparis is offline  
Old 11-16-2010, 10:03 AM   #13
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
Default

We plan to have a resolution to this with NinjaTrader 7.0.1000.5.
NinjaTrader_Bertrand 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
Session Problems : FirstBarOfSession isn't zark.be Version 7 Beta General Questions & Bug Reports 3 10-06-2010 09:10 AM
Beta 15 - problems loading last few ticks of data for CL 09-10 JS999 Version 7 Beta General Questions & Bug Reports 6 07-19-2010 08:43 AM
End of session BaRs problem/Residual ticks david111 Version 7 Beta General Questions & Bug Reports 3 04-15-2010 09:08 AM
BeginTime EndTime timezone ? gomifromparis Version 7 Beta General Questions & Bug Reports 21 02-12-2010 09:11 AM
Draw a line, session open minus 20 ticks suprsnipes Indicator Development 5 11-07-2009 09:36 AM


All times are GMT -6. The time now is 12:26 AM.