Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DataSeries linked to Supplementary Bar Series: New Constructor

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

    DataSeries linked to Supplementary Bar Series: New Constructor

    I am trying to develop a multi-time-frame strategy and want to link some local DataSeries to different bars.

    Prior to NT7 there was no StartUp function where you had access to the BarsArray[]. As a result you would end up doing the synchronization in the first call to OnBarUpdate(). Further the effect was obtained by passing your data-series to another Indicator and using that value to call the constructor for the DataSeries object.

    It would be nice to be able to do the following in the StartUp function:


    Code:
    secondarySeries = new DataSeries(BarsArray[1]);
    Instead of the code below:


    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

    Code:
    			/* Only need to sync DataSeries objects once. We couldn't do this sync in the Initialize() method because we
    			cannot access the BarsArray property there. */
    			if (secondarySeries == null)
    			{
    				/* Syncs another DataSeries object to the secondary bar object.
    				We use an arbitrary indicator overloaded with an IDataSeries input to achieve the sync.
    				The indicator can be any indicator. The DataSeries will be synced to whatever the
    				BarsArray[] is provided.*/
    				secondarySeries = new DataSeries(SMA(BarsArray[1], 50));
    			}

    #2
    aviat72, thanks for sharing those suggestions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    628 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    359 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    562 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X