Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 algospoke, Yesterday, 06:40 PM
          2 responses
          22 views
          0 likes
          Last Post algospoke  
          Started by ghoul, Today, 06:02 PM
          3 responses
          14 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          45 views
          0 likes
          Last Post jeronymite  
          Started by Barry Milan, Yesterday, 10:35 PM
          7 responses
          21 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by AttiM, 02-14-2024, 05:20 PM
          10 responses
          181 views
          0 likes
          Last Post jeronymite  
          Working...
          X