Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

add dataseries for certain number of days

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

    add dataseries for certain number of days

    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, int barsToLoad, string tradingHoursName, bool? isResetOnNewTradingDay)

    I am trying to add a variable number of days to my indicator. I am using a 1 tick dataseries and in my example I am trying to load 10 days worth of tick data. The added series only returns back 10 bars of data instead of 10 days, what am I doing wrong?

    Code:
    BarsPeriod p = new BarsPeriod();
    p.BarsPeriodType = BarsPeriodType.Tick;
    p.Value = 1;
    p.MarketDataType = MarketDataType.Last;
    
    AddDataSeries(Instrument.FullName,p, 10 ,TradingHours.Name,true);
    I understand that int barsToLoad is loading 10 bars, but in other forum posts NT says it should be loading a certain number of days in that parameter. If it really is just loading the number of bars, how do I calculate the number of ticks i need to load to get 10 days worth of tick data?

    #2
    What is TradingHours.Name set to?

    Comment


      #3
      TradingHours.Name = "CME US Index Futures RTH"

      This is just the normal CME pit hours for ES.

      If I manually enter 2400000 I get the 10 days of tick data w/ 2400000 bars, if I use the actual number of days (10) , i only get 10 ticks of data. I don't think this function is implemented properly.

      Comment


        #4
        Originally posted by habibalex View Post
        TradingHours.Name = "CME US Index Futures RTH"

        This is just the normal CME pit hours for ES.

        If I manually enter 2400000 I get the 10 days of tick data w/ 2400000 bars, if I use the actual number of days (10) , i only get 10 ticks of data. I don't think this function is implemented properly.
        You are requesting Tick, and the period type is 10, so you would get 10 bars of tick.




        periodType The BarsType used for the bars period
        *
        Possible values are:
        *
        •BarsPeriodType.Tick
        •BarsPeriodType.Volume
        •BarsPeriodType.Range
        •BarsPeriodType.Second
        •BarsPeriodType.Minute
        •BarsPeriodType.Day * * * *
        •BarsPeriodType.Week
        •BarsPeriodType.Month
        •BarsPeriodType.Year

        period
        An int determining the period interval such as "3" for 3 minute bars


        The example in the documentation:

        Code:
        * * // Add a 100 tick Bars object for the ES 09-14 contract - BarsInProgress index = 2 
        * * * * AddDataSeries("ES 09-14", BarsPeriodType.Tick, 100);

        Comment


          #5
          As stated in my first post, how do I calculate the number of ticks I need to load to get 10 days worth of tick data?

          I don't believe this function is implemented in a logical way. In addition, the structure of the ncd files in NT8s database makes it very easy to just grab 10 days worth of data. I used to do this manually with the NT7 ntd files by reading them directly and bypassing NT7s slow load times.

          Comment


            #6
            Hello habibalex,

            You may be trying to do something with AddDataSeries() that it was not designed for.

            The AddDataSeries() method does not allow for a parameter to select a number of days but only allows a selection of a number of historical bars.


            Am I correct in understanding what you are asking is how to calculate how many ticks there are in a day so that you can predict how many bars to load you will need to have the data start at a certain time?
            This is impossible to know without first downloading the data and then counting. It is impossible to know how many ticks there are even in a single minute.
            Ticks are produced as orders are filled. If the market is slower, meaning less people are trading, there will be less ticks than a market that is moving faster, or has more volume.

            If the barsToLoad overload is not used, this will cause the secondary series to pull data using the same parameters of the primary series. I.e. a number of days where the time length of data would match, or a number of bars where the time length of the data may not match.

            A BarsRequest would allow you to pull any data arbitrarily for any amount of days or amount of bars. However, the bars object this creates cannot be supplied as the input series for a indicator.
            You can however, do any custom calculations you would like to with the data and present this in anyway you would like. (Meaning you would need to do the calculations of an indicator in that script instead of calling the indicator)
            This would accomplish your goal of getting an arbitrary amount of days of data, but would require more code in the script to accomplish.


            Would you like to submit a feature request to provide functionality that is not currently available?
            If so, what would you like this feature request to say?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Am I correct in understanding what you are asking is how to calculate how many ticks there are in a day so that you can predict how many bars to load you will need to have the data start at a certain time?
              Yes this is exactly what I was looking for. Thanks for showing me the BarsRequest method, I will use this.


              This is impossible to know without first downloading the data and then counting. It is impossible to know how many ticks there are even in a single minute.
              I'm not really interested in knowing the exact number of ticks to load but the way AddDataSeries is written, I would have to know that. The .ncd files are organized by Date and Time so if I could just specify the start date, nt8 could load it how it is being loaded with the BarsRequest method.

              Would you like to submit a feature request to provide functionality that is not currently available?
              If so, what would you like this feature request to say?
              If you could add another overload to the AddDataSeries which replaces int barsToLoad with DateTime startDateToLoad, I think that would be the easiest solution.

              Comment


                #8
                Hello habibalex,

                I have received a tracking ID for your feature request. Your request to add an overload to AddDataSeries for the days load is being tracked with ID# SFT-1853.

                It is up to the NinjaTrader Development to decide if and when a request will be implemented. That said, we highly value your feedback and would appreciate any other requests you have for the NinjaTrader platform.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Any update on this? It's taking like 10 minutes to load 2.5M ticks on a Default 24x7 chart. I really would like to just add a certain number of days to my chart rather than an arbitrary amount of ticks.

                  I'm not sure why it's so slow right now, it usually takes around 10 seconds to do the same thing. CME US Index Futures RTH chart seems to load in about 10 seconds right now though.

                  Comment


                    #10
                    Hello habibalex,

                    At this time request #SFT-1853 has not been implemented.
                    It is up to the NinjaTrader Development to decide if and when a request will be implemented.

                    You can do a BarsRequest in the Indicator instead of using DataSeries.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Hi ChelseaB, I would like this to be added as well.

                      Comment


                        #12
                        Hello bigsnack,

                        Your vote has been added.

                        Thank you for your feedback.
                        Chelsea B.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Perr0Grande, Today, 08:16 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post Perr0Grande  
                        Started by elderan, Today, 08:03 PM
                        0 responses
                        5 views
                        0 likes
                        Last Post elderan
                        by elderan
                         
                        Started by algospoke, Today, 06:40 PM
                        0 responses
                        10 views
                        0 likes
                        Last Post algospoke  
                        Started by maybeimnotrader, Today, 05:46 PM
                        0 responses
                        12 views
                        0 likes
                        Last Post maybeimnotrader  
                        Started by quantismo, Today, 05:13 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post quantismo  
                        Working...
                        X