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 kinfxhk, 07-14-2026, 09:39 AM
    0 responses
    10 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    59 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    41 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    47 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    38 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X