Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time of first tick of bar (Open)?

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

    Time of first tick of bar (Open)?

    1. Can I determine the time of the first tick of a bar (the time of bar open) on historical data?

    2. Is there a way to call or reference the Session Opening time (the value that is set in the chart properties)?

    I am trying to find a way to calculate the length of time to complete the first bar of a session on a tick or volume bar without hard coding the session start time. Thanks.

    #2
    Originally posted by higler View Post
    2. Is there a way to call or reference the Session Opening time (the value that is set in the chart properties)?
    I tried using the Bars.SessionBegin. I did Print(Bars.SessionBegin) in my Indicator code and I continuously get todays date and SessionBegin time (even for previous days chart bars). To do the calculation that I want I need the SessionBegin to have the appropriate day's date and SessionBegin time and not today's unless I am looking at todays bars. How do I get previous days' SessionBegin DateTime to be correct?

    Comment


      #3
      1. No.

      2. Not supported at this time.
      RayNinjaTrader Customer Service

      Comment


        #4
        Thanks. I think that I can probably do what I want by monitoring for the first bar of a session and extracting the Date portion of Time[0] when FirstBarOf Session is true and extracting the time portion of Bars.SessionBegin (since it seems to have continuously the current date but the correct SessionBegin time) and combining those date and time components to give me the session opening date/time for each day's session. That should get me close enough to what I want to do. I'll just need to dig a little farther into C#.

        Comment


          #5
          Hi higler,

          If you check out the code for the VWAP indicator you will see some techniques that may interest you in terms of getting dates and times. They may not necessarily be the most efficient method, but it gets the job done.
          Josh P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          599 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          344 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          558 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          557 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X