Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.GetBar(time)

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

    Bars.GetBar(time)

    I am using this
    Code:
    int bar1 = Bars.GetBar(p1Time);   // Returns the number of bars ago
    to get the bar parameter based on a DateTime variable to use in a DrawLine() method. It returns 15472 & I am pretty sure my chart is NOT that big. Sure nuf, an error in the log. What did I do wrong?

    Bars are CVB (Volume based) - but your X-axis is labeled with time so logically you know what the time of the bar was...

    #2

    Just use GetBar() not Bars.GetBar().
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks, Josh. that was it

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      572 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      331 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
      549 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      550 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X