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

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
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rtwave, 04-12-2024, 09:30 AM
        4 responses
        31 views
        0 likes
        Last Post rtwave
        by rtwave
         
        Started by yertle, Yesterday, 08:38 AM
        7 responses
        29 views
        0 likes
        Last Post yertle
        by yertle
         
        Started by bmartz, 03-12-2024, 06:12 AM
        2 responses
        22 views
        0 likes
        Last Post bmartz
        by bmartz
         
        Started by funk10101, Today, 12:02 AM
        0 responses
        7 views
        0 likes
        Last Post funk10101  
        Started by gravdigaz6, Yesterday, 11:40 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X