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 Mindset, 04-21-2026, 06:46 AM
            0 responses
            88 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            134 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            68 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            118 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            67 views
            0 likes
            Last Post PaulMohn  
            Working...
            X