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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    41 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X