Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.GetDayBar(1).Close for multi-instrument

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

    Bars.GetDayBar(1).Close for multi-instrument

    hi,

    I'm trying to add 2nd instrument to the program,

    under Initialize(),
    Add("ES 03-12", PeriodType.Minute, 5);

    any idea how can i get px change this additional instrument??

    Closes[1][0] - Bars.GetDayBar(1).Close ??

    if i use Bars.GetDayBar(1).Close, it will gimme the previous closing px of Closes[0][0],

    many thanks,

    Adam

    #2
    Hi Adam,
    Thanks for the post. Can you please clarify what calculation you're looking for?
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      hi Ryan,

      thanks for fast reply,

      im trying to calculate price change relative to previous day close,

      thanks,

      Comment


        #4
        I don't feel you would need a multitime frame script for this. The last price is available with value Close[0] when CalculateOnBarClose = false. You can then make comparisons with this value and the built in PriorDayOHLC()


        GetDayBar() is similar to this, but is intended for session data beyond the current, and previous day.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          thanks for telling me about the PriorDayOHLC(), i guess i make you confuse, my bad,

          the case like this, im trying to print 2 instrument price changes to output window at the same time , let say "msft" and "intel", 5 minutes bars, price change = close[0] - PriorDayOHLC().PriorClose[1],

          under "if( BarsInProgress == 0)", PriorDayOHLC().PriorClose[1] is the prior closing price for the default instrument, "msft"

          my question is how can i get PriorDayOHLC().PriorClose[1] for "intel"??

          Comment


            #6
            Thanks for clarifying. I'm happy to help. You would need to include an Add() statement adding intel. You can access its values with Closes, or filtering updates within a specific BarsInProgress, which would allow you to access the same PriorDayOHLC.

            There is a sample multi instrument strategy available through Tools > Edit NinjaScript > Strategy. Documentation for this is here:
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

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