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 DJ888, Today, 10:57 PM
          0 responses
          1 view
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          158 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Today, 09:29 PM
          0 responses
          7 views
          0 likes
          Last Post Belfortbucks  
          Started by zstheorist, Today, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          151 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Working...
          X