Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.LastOfSession

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

    Bars.LastOfSession

    May I suggest adding this bool to complement the Bars.FirstOfSession that is already available? It would be useful for indicators that need to reset values before the next session instead of at the start of the next session.
    Last edited by NinjaTrader_JoshP; 08-15-2007, 04:17 AM.
    Josh P.NinjaTrader Customer Service

    #2
    The problem with this is that you would not know if you have seen the last tick of a session until the session is over in which event no further OnBarUpdate method would be triggered -> LastOfSession always would be false in your OnBarUpdate method.

    Comment


      #3
      I meant Bars not ticks. You should be able to know if this would be the last bar of the session based on what time the bar is building for. If the bar is building for any time past the Session End time then the bool should return true. This is how the Bars.FirstOfSession behaves too. It returns true anytime throughout the bar, not just at the first tick of the bar or the last tick of the bar.

      While I'm on a Bars.* topic I noticed that Bars.SessionEnd produces a weird DateTime date. Using Bars.SessionBegin prints out "8/15/2007 6:30:00 AM", but Bars.SessionEnd prints out "7/27/2007 1:00:00 PM". Why are they different dates? This makes it useless to do a simple (Bars.SessionEnd-Bars.SessionBegin) for use in trying to create my own Bars.LastOfSession bool.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Got it. Will add to the list. Thanks for your suggestion.

        The date portion of SessionBegin/End is irrelevant, only the time portion is.

        Comment


          #5
          At the moment if I do Bars.SessionEnd-Bars.SessionBegin this is the output I get:
          Code:
          Session Begin: 8/15/2007 6:30:00 AM Session End: 7/27/2007 1:00:00 PM End-Begin: -18.17:30:00
          It is taking the difference in dates not just times into the TimeSpan calculation.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Right, as explained below the date portion is irrelevant, it could have any value. Only the time portion is relevant. Your math below could return any result.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by wzgy0920, 04-20-2024, 06:09 PM
            2 responses
            27 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, 02-22-2024, 01:11 AM
            5 responses
            32 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, 04-23-2024, 09:53 PM
            2 responses
            49 views
            0 likes
            Last Post wzgy0920  
            Started by Kensonprib, 04-28-2021, 10:11 AM
            5 responses
            193 views
            0 likes
            Last Post Hasadafa  
            Started by GussJ, 03-04-2020, 03:11 PM
            11 responses
            3,235 views
            0 likes
            Last Post xiinteractive  
            Working...
            X