Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting the current bar's open price

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

    #16
    Hello takeaseat,

    The time series represents the bar close times. Using negative indexes as a bars ago is not valid, that would be looking into the future that has not happened yet.

    Comment


      #17
      Time[0].Minute-1 is what I meant sorry
      Edit: This *seems* to be working

      Comment


        #18
        Hello takeaseat,

        That would give you the time of the closed bar if you were using a 1 minute series. You can alternatively use Time[1] to get the last closed bars time. Time[0] will print the building bars anticipated close time.

        Comment


          #19
          Ah gotcha. I am testing on 1 minute and iterating changes. Is there a function to get the timeframe as an int? Like 15 minute chart, returns 15 etc

          Comment


            #20
            Hello takeaseat,

            Yes you can use Bars.BarsPeriod.Value

            Keep in mind this can only be used while the script is running from OnBarUpdate, Bars should not be used in OnStateChange SetDefaults or Configure.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            78 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            40 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            63 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            63 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            54 views
            0 likes
            Last Post CarlTrading  
            Working...
            X