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 GussJ, 03-04-2020, 03:11 PM
            11 responses
            3,227 views
            0 likes
            Last Post xiinteractive  
            Started by andrewtrades, Today, 04:57 PM
            1 response
            13 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by chbruno, Today, 04:10 PM
            0 responses
            7 views
            0 likes
            Last Post chbruno
            by chbruno
             
            Started by josh18955, 03-25-2023, 11:16 AM
            6 responses
            440 views
            0 likes
            Last Post Delerium  
            Started by FAQtrader, Today, 03:35 PM
            0 responses
            12 views
            0 likes
            Last Post FAQtrader  
            Working...
            X