Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Secondary Bar Object DataSeries

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

    Secondary Bar Object DataSeries

    have primary 60min bar object and secondary daily bar object.

    is there a recommended way to reference previous daily bar object [1] and possibly [2] & [3] (and any user defined dataseries based on the secondary bar series)?

    I understand primary dataseries [1] (at say 11:00) also has corresponding secondary dataseries [1] (at say 11:00) but this isn't previous day unless it copies previous value until new day and a new series element is added?

    so this would solve how to access [1] but not [2] & [3].

    Do I need to write code for this?
    Last edited by futurenets; 02-28-2015, 01:11 PM.

    #2
    Hello,

    Thank you for your note.

    When multiple data series are used, the BarsInProgress index will let you know what data you are accessing and which series OnBarUpdate is processing.

    For example in OnBarUpdate():

    if (BarsInProgress == 0)
    {
    // the primary data series is processing
    }
    if (BarsInProgress == 1)
    {
    // the secondary series is processing
    }

    Below is a link to BarsInProgress.
    http://www.ninjatrader.com/support/h...inprogress.htm

    Data is access using the BarsInProgress index you want data from.
    For example if we want the close price of the secondary data series.
    Closes[1][0].
    Closes[BarsInProgress index][bars ago value]

    Below is a link to Closes.
    http://www.ninjatrader.com/support/h...nt7/closes.htm


    Lets say when the secondary series is processing we want the close price of the primary data series from 1 bar ago.

    if (BarsInProgress == 1)
    {
    Print(Closes[0][1]);
    }

    Below is a link to the help guide on Multi-Time Frame & Instruments. Please see the sections 'How Bar Data is Referenced' and 'Accessing the Price Data in a Multi-Bars NinjaScript'.
    http://www.ninjatrader.com/support/h...nstruments.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ok thanks

      a bit difficult to explain but here goes ...

      the attached image is the output from the attached indicator.

      it shows how I can reference Closes[0] & Closes[1] barsago - no problem.

      but if I add my own DataSeries to store data about the Secondary and then want to reference this "barsago" it will be sync'd with the primary?

      e.g. I'm trying to have a DataSeries where value [2] would correspond to value [2] of the secondary bar object.

      hope that makes sense?
      Attached Files

      Comment


        #4
        futurenets, per default that would be primary, yes. You can however sync to any other series you added, here's an example -

        Note: In NinjaTrader 8 It is no longer needed to use an indicator to sync a secondary series. This can be done directly from the Series<T> (https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?seriest.htm) constructor. This post is left for historical purposes. Series objects are useful for

        Comment

        Latest Posts

        Collapse

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