Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.GetBar in Multi Time Frames?

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

    Bars.GetBar in Multi Time Frames?

    I am using Bars.GetBar(DateTime targetTime) to find the index of a bar at a certain date back in time. I understand this function, and it behaves as I expect. So, to find the High of a given DateTime, I am using High[CurrentBar - Bars.GetBar(myDateTime)].

    Now, I would like to do the same thing in multiple time frames. It is obvious that for an given DateTime, the lookback bars will be different for different time frames.

    How do I do this? I would like to do something like Bars.GetBar(Input[2],myDateTime) or Bars[2].GetBar(myDateTime).

    Does this make sense?

    Thanks!

    #2
    Hello Serac,

    You would use the BarsArray[] method as it would be used for working with Multiseries scripts. Here is a a link to our Help Guide on BarsArray[].



    Example:
    Code:
    BarsArray[1].GetBar(Time[0]);
    JCNinjaTrader Customer Service

    Comment


      #3
      Fantastic. I hadn't got the connection between Bars and BarsArray until now.

      Thanks.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      566 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X