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 wooofad, Today, 05:38 PM
          0 responses
          4 views
          0 likes
          Last Post wooofad
          by wooofad
           
          Started by caacapital, Today, 10:10 AM
          1 response
          15 views
          0 likes
          Last Post NinjaTrader_ShawnB  
          Started by DiverG20, Today, 10:23 AM
          0 responses
          22 views
          0 likes
          Last Post DiverG20  
          Started by SuneSorgenfrei, Today, 09:29 AM
          0 responses
          22 views
          0 likes
          Last Post SuneSorgenfrei  
          Started by dodoei, Today, 07:24 AM
          0 responses
          14 views
          0 likes
          Last Post dodoei
          by dodoei
           
          Working...
          X