• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Rollile, Today, 03:48 AM
    0 responses
    3 views
    0 likes
    Last Post Rollile
    by Rollile
     
    Started by Timothy951, Today, 03:01 AM
    0 responses
    3 views
    0 likes
    Last Post Timothy951  
    Started by U0000999, Today, 02:50 AM
    0 responses
    1 view
    0 likes
    Last Post U0000999  
    Started by Hiromichi, Today, 02:33 AM
    0 responses
    2 views
    0 likes
    Last Post Hiromichi  
    Started by johnnybegoode, Yesterday, 07:15 PM
    0 responses
    4 views
    0 likes
    Last Post johnnybegoode  
    Working...
    X