Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Working with Multiple DataSeries

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

    Working with Multiple DataSeries

    Hi guys,

    In my strategy I am working with 2 DataSeries which I have loaded in State.Configure as follows:
    Code:
    if (State == State.Configure)
        {
            AddDataSeries(BarsPeriodType.Minute, 120);
            AddDataSeries(BarsPeriodType.Minute, 1);
        }
    During OnBarUpdate(), I need to get the value of 'CurrentBar' for the 1-min DataSeries. However if I assign CurrentBar to a variable, the variable takes on the value of the CurrentBar of the 120-min DataSeries. How can I access the value of the 1-min CurrentBar?

    #2
    Hello Bluebeep,

    Thanks for your post.

    In a multi Timeframe script, each added data series will also call OnBarUpdate(). You can determine which data series is calling OnBarUpdate() by checking the BarsInProgress value. BarsInProgress will be 0 for the chart/primary bars, 1 for your 120 minutes series and 2 for your 1-minute bar.

    Note, the "value" of CurrentBar is the bar number. In a multi-timeframe script, you can use CurrentBars[] where the index would be the BarsInProgress. To get the current bar number of the 1 minute data series you would use CurrentBars[2].

    We highly recommend you review the help guide section in sequence here: https://ninjatrader.com/support/help...nstruments.htm

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    41 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    64 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X