Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add DataSeries() Order

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

    Add DataSeries() Order

    Hello,

    When adding multiple DataSeries to a Strategy, containing different Instruments and Time Frames for each one - What is the order of precedence for how I add the lines of code so that I can achieve granularity?


    The Default Data Series (//BarsInProgress = 0) would be a 1-min chart of SPY that the strategy would be running on.


    Ex. 1


    else if (State == State.Configure)
    {
    AddDataSeries("SPY", Data.BarsPeriodType.Day, 1, Data.MarketDataType.Last); //BarsInProgress = 1
    AddDataSeries("SPY", Data.BarsPeriodType.Minute, 60, Data.MarketDataType.Last); //BarsInProgress = 2
    AddDataSeries("SPY", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last); //BarsInProgress = 3
    AddDataSeries("DIA", Data.BarsPeriodType.Day, 1, Data.MarketDataType.Last); //BarsInProgress = 4
    AddDataSeries("DIA", Data.BarsPeriodType.Minute, 60, Data.MarketDataType.Last); //BarsInProgress = 5
    AddDataSeries("DIA", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last); //BarsInProgress = 6

    }

    Or is it coded as...

    Ex. 2

    else if (State == State.Configure)
    {
    AddDataSeries("SPY", Data.BarsPeriodType.Day, 1, Data.MarketDataType.Last); //BarsInProgress = 1
    AddDataSeries("DIA", Data.BarsPeriodType.Day, 1, Data.MarketDataType.Last); //BarsInProgress = 2
    AddDataSeries("SPY", Data.BarsPeriodType.Minute, 60, Data.MarketDataType.Last); //BarsInProgress = 3
    AddDataSeries("DIA", Data.BarsPeriodType.Minute, 60, Data.MarketDataType.Last); //BarsInProgress = 4
    AddDataSeries("SPY", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last); //BarsInProgress = 5
    AddDataSeries("DIA", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last); //BarsInProgress = 6


    }



    Thanks in Advance.
    Last edited by BrianL; 05-03-2016, 01:28 PM.

    #2
    Hello BrianL,

    Thank you for your post.

    You should not have to put these in a specific order. It should be the order you prefer.
    Are you running into anything that prevents you from using a certain order?

    Comment


      #3
      I just remember that in NT7 the order had to be specific, as in the larger Data Series, ie Daily, had to be placed before the lower Minute Data Series to get granularity to work right. Every time I put the Minute ones before the Daily/Weekly/Monthly, or the 60min ahead of the 5min, etc. my script wouldn't calculate properly. I was wondering if this were true for NT8 as well.

      Comment


        #4
        Hello BrianL,

        Thank you for your response.

        This would not be necessary in NinjaTrader 8.

        Comment


          #5
          Thanks for clarifying.

          Comment


            #6
            Originally posted by BrianL View Post
            I just remember that in NT7 the order had to be specific, as in the larger Data Series, ie Daily, had to be placed before the lower Minute Data Series to get granularity to work right. Every time I put the Minute ones before the Daily/Weekly/Monthly, or the 60min ahead of the 5min, etc. my script wouldn't calculate properly. I was wondering if this were true for NT8 as well.
            I am not 100% why the order would have mattered even in NT7, but to jog your memory: Perhaps you are referring to the order in which BarsArray gets added and the corresponding BarsInProgress?

            Unless you are doing specific BarsInProgress filtering in your OnBarUpdate method, the order in which a series is called will depend on the order they are declared - but the usually is not an "issue" per se as long as you are diligent about the BarsArray[idx] or BarsInProgress series before accessing values. This is true for NT7 and NT8.
            MatthewNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by aussugardefender, Today, 01:07 AM
            0 responses
            3 views
            0 likes
            Last Post aussugardefender  
            Started by pvincent, 06-23-2022, 12:53 PM
            14 responses
            238 views
            0 likes
            Last Post Nyman
            by Nyman
             
            Started by TraderG23, 12-08-2023, 07:56 AM
            9 responses
            384 views
            1 like
            Last Post Gavini
            by Gavini
             
            Started by oviejo, Today, 12:28 AM
            0 responses
            4 views
            0 likes
            Last Post oviejo
            by oviejo
             
            Started by pechtri, 06-22-2023, 02:31 AM
            10 responses
            125 views
            0 likes
            Last Post Leeroy_Jenkins  
            Working...
            X