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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      181 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      334 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      258 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      358 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      187 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X