Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.

    JesseNinjaTrader Customer Service

    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 bortz, 11-06-2023, 08:04 AM
      47 responses
      1,607 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      9 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      19 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      6 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      15 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X