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[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 pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          148 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          5 views
          0 likes
          Last Post mattbsea  
          Started by RideMe, 04-07-2024, 04:54 PM
          6 responses
          33 views
          0 likes
          Last Post RideMe
          by RideMe
           
          Started by tkaboris, Today, 05:13 PM
          0 responses
          5 views
          0 likes
          Last Post tkaboris  
          Started by GussJ, 03-04-2020, 03:11 PM
          16 responses
          3,282 views
          0 likes
          Last Post Leafcutter  
          Working...
          X