Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.GetOpen in Multi-Instrument strategy

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

    Bars.GetOpen in Multi-Instrument strategy

    I use this statement to get the open from the next future bar:

    Bars.GetOpen(CurrentBar+1)

    I would like to use this function for a second DataSeries within the strategy. But there seems to be no statement like e.g.

    Bars.getOpens[0][1](....

    Are there other solutions?

    #2
    Hello starcd,

    If you wanted to use that function for a secondary series you would need to use the secondary bars object. Bars refers to the Primary series always. You could try BarsArray[1] instead.

    Just as a heads up, its not expected to be able to retrieve future data when using the BarsAgo system or in general. When using a series that has BarsAgo that is the data up until that point in processing and the BarsAgo refers to bars in the past from that point. The GetOpen or GetValueAt methods use a specific bar index and observe the whole series at once. Those methods are generally not used in contexts where you are stepping through the data like OnBarUpdate because you can't look into the future in realtime data. Trying to do that in realtime data may produce odd results.

    I look forward to being of further assistance.

    Comment


      #3
      Thank you, that worked.! Don't worry, the function is only important for backtesting in my strategy. But of course I understand the hint.

      Comment

      Latest Posts

      Collapse

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