Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time[0] - time of open or close of the bar?

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

    Time[0] - time of open or close of the bar?

    Is Time[0] the time of open or close of the bar?

    Also is there a method to get a bar number that starts at a specified time?

    #2
    Hello Gregid,

    Time[0] will return the bar timestamp.

    Note that time based charts have the bar timestamp at the end of the time interval. Meaning if it is 9:30 and you have a one minute chart then the bar being built will be 9:31

    If you have a Tick based chart it will return when the new bar starts to build.

    If you can use CurrentBar to return the number of bars that are throughout the chart from Right to Left.

    Let me know if I can be of further assistance
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Cal,

      So if I want to know open and close time and am accessing range bar, the Time[32] will be the open of the bar #32 (0 indexed) and Time[31] its close time, am I correct?

      As to the second question - I am trying to get values of secondary BarsArray that are within primary bar and tried to avoid looping through entire BarsArray to get the values, so I understand there is no specific method to get bar number by providing time?

      Comment


        #4
        Hello Gregid,

        Correct, as the last tick of a bar is the first tick of the next bar.

        For the second question, BarsArray[0].GetBar(); should get you what you are looking for.
        http://www.ninjatrader.com/support/h...?barsarray.htm
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Thanks,

          BarsArray[0].GetBar();

          is what I needed.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          578 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X