Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PercentComplete incorrect for Day bars if session started previous day

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    PercentComplete incorrect for Day bars if session started previous day

    When using PeriodType.Day on single day bars (BarsPeriod.Value==1):

    PercentComplete seems to ignore the actual session and seems to just calculate "percentage of a 24 hour day that has elapsed since midnight". But this is incorrect. It does not comply with the documentation since (in all the session definitions I use) the real bar did not begin at midnight and will not end at midnight.
    Last edited by DaveE; 12-11-2013, 10:35 AM. Reason: problem not limited to sessions starting previous date

    #2
    Hello DaveE,

    Thanks for reporting this.

    I am not sure of the exact logic here using Daily bars as they should be unaffected by a Session Template but I am getting some different results. Could you give me an example of what you are doing and the results that you are getting so that I can make sure that we are looking at the same thing?

    Using real-time data I get the same "Bars.PercentComplete" but using Historical Data when it is first loaded the "Bars.PercentComplete" returns the current days value and when a Session Template is changed then Historically it will return 1 which would be expected.

    Happy to look into this further.
    JCNinjaTrader Customer Service

    Comment


      #3
      even more mysterious for multiple day bars

      I originally thought the problem with PercentComplete on Day bars was limited to cases where session started before the current date. However looking again its also turned out to be wrong for sessions starting and ending in the same date. So to keep things simple for testing I decided to use session 'Liffe Commodities 1' just because its my time zone GMT.
      Session starts 9:00 ends 17:30, so a 'day' bar should cover 8.5 hours.

      If I request a 2 Day series (Value=2) then I expect each bar to cover 17 hours.

      At ~17:15 GMT on 11 Dec:
      On Chart (using Data Box) the previous bar is shown closing at 9 Dec 17:30 (OK), and bar being built is shown closing 11 Dec 17:30 (OK). But PercentComplete at this time is showing 0.859... (which is incorrect and I have no idea how its being calculated).
      At this time 16.75 hours have completed out of the 17 hour 2-day bar. So I would expect to see 16.75/17, ie PercentComplete SHOULD BE = 0.985...

      Comment


        #4
        Originally posted by NinjaTrader_JC View Post
        Hello DaveE,

        Daily bars ... should be unaffected by a Session Template
        But daily bars have to be affected by the session template.
        Example: If I want 2 day bars, and the last bar started say Friday 9:00, then if the session defines a weekend break I expect the bar being built to end on Monday. And this is in fact what happens correctly on Charts etc. In this case if the bars were really unaffected by session, then the bar being built would end on Saturday.

        Comment


          #5
          Hello DaveE,

          Thanks for the information.

          It is on our Feedback list to have Daily Data be affected by a Session Template that we are looking into for NinjaTrader 8 but in NinjaTrader 7 Daily Data is going to be reported by the Data Provider so it should have no effect on the Bars.PercentComplete. So no matter the session template that you use on a Daily time frame you should not see the "Bars.PercentComplete" change.

          Let me know if you have any questions.
          JCNinjaTrader Customer Service

          Comment


            #6
            I guess this is not going to get fixed for NT7, so I would like to make the following request for NT8:

            Documented access to basic information about the 'bar being built' especially:
            • Property: BarStart (DateTimeOffset). This is not necessarily the same as Time[0] (of previous closed bar) because there might have been a session break in between.
            • Property: ExpectedEnd (DateTimeOffset). This needs to be calculated using session info.
            • Property: ExpectedInSessionTimeSpan (this is timespan of the bar from BarStart to ExpectedEnd with all the intermediate session breaks chopped out)
            • Method: InSessionTimeSpan(DateTimeOffset dt) which returns the TimeSpan from BarStart to dt, with any intermediate session breaks chopped out.


            With info like this its easy for the user to calculate their own derived stats. So for example if I was using 2 day bars anyone could calculate a true percentComplete something like this:
            Code:
            //BBB is a mythical object providing info about the Bar Being Built
            TimeSpan CompletedInSessionTimeSpan = BBB.InSessionTimeSpan(DateTimeOffest.Now);
            double percentComplete = CompletedInSessionTimeSpan.TotalHours / BBB.ExpectedInSessionTimeSpan.TotalHours

            Comment


              #7
              Hello DaveE,

              Thanks for the detailed explanation. I will forward these suggestions to our Development team for NT8.
              JCNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by cmtjoancolmenero, Yesterday, 03:58 PM
              3 responses
              23 views
              0 likes
              Last Post cmtjoancolmenero  
              Started by Brevo, Today, 01:45 AM
              1 response
              14 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by rjbtrade1, 11-30-2023, 04:38 PM
              2 responses
              72 views
              0 likes
              Last Post DavidHP
              by DavidHP
               
              Started by suroot, 04-10-2017, 02:18 AM
              5 responses
              3,021 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by Stanfillirenfro, Today, 07:23 AM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X