Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can I get AddDataSeries to load the same number of bars as the primary series?

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

    How can I get AddDataSeries to load the same number of bars as the primary series?

    Hi,

    NT is awesome.

    How can I get AddDataSeries to load the same number of bars as the primary data series? Where the primary data series is 200 bars of 15 minute data (ie 8 days), shouldn't AddDataSeries(BarsPeriodType.Day, 1) load 200 bars of daily data?

    In my tests, it's only loading 8 bars (days) because 200 15minute equals 8 days.
    Is this a bug or a feature request?




    One work around is to load 200 days (not bars) of 15 minute data but performance hurts because I don't need that much 15 minute data.




    The other work around is to use below which NT doesn't recommend.
    AddDataSeries(Instrument.FullName, new BarsPeriod { BarsPeriodType = BarsPeriodType.Day, Value = 1 }, 200, TradingHours.Name, false);


    Lots of other posts request something similar.

    #2
    Hello

    Thanks for the post.

    Please see post #4 from this thread that explains how to fix this:



    You will want to load the primary data series based on bars instead of days in the Data Series menu to load an equal amount of bars.

    Please let me know if I may be of any further assistance.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      What fast response ChrisL.


      From that post ...

      "So if I set 500 bars, both the 1 minute (primary) and 60 minute (secondary) bar series will load 500 bars"



      This is what I supposed would happen but it's not. I know it's not because of the following printout



      else if (State == State.DataLoaded)
      {
      Print(" CalcWhich " + CalcWhich + " Instrument.FullName " + Instrument.FullName + " Bars.Count " + Bars.Count + " Bars.FromDate " + Bars.FromDate + " Bars.ToDate " + Bars.ToDate
      + " BarsArray[0].BarsPeriod.BarsPeriodType " + BarsArray[0].BarsPeriod.BarsPeriodType + " BarsArray[1].BarsPeriod.BarsPeriodType " + BarsArray[1].BarsPeriod.BarsPeriodType
      + " BarsArray[1].Instrument.FullName " + BarsArray[1].Instrument.FullName + " BarsArray[1].Count " + BarsArray[1].Count + " BarsArray[1].DayCount " + BarsArray[1].DayCount
      + " BarsArray[1].FromDate " + BarsArray[1].FromDate + " BarsArray[1].ToDate " + BarsArray[1].ToDate
      + " BarsPeriodType.Day " + BarsPeriodType.Day
      );
      }


      Above outputs 200 for Bars.Count (15 minutes) but only 9 for BarsArray[1].Count (Daly)







      Again, primary is set to 200 Bars of 15 minutes while my indicator should load 200 bars of daily AddDataSeries(BarsPeriodType.Day, 1).



      When I change 200 to 300 then 9 goes to 12. Then 300 to 400 then 12 goes to 16.


      Any ideas?

      Comment


        #4
        Hello sajosh,

        Thanks for the reply.

        I want to confirm that you set "Load data based on" to "Bars" in the Data Series menu. I tested it and my script printed out 200 for both the 15-minute series and the daily series.

        Here is my output:

        Instrument.FullName NQ 09-18 Bars.Count 200 Bars.FromDate 2018-07-10 12:00:00 AM Bars.ToDate 2018-07-12 12:00:00 AM BarsArray[0].BarsPeriod.BarsPeriodType Minute BarsArray[1].BarsPeriod.BarsPeriodType Day BarsArray[1].Instrument.FullName NQ 09-18 BarsArray[1].Count 200 BarsArray[1].DayCount 1 BarsArray[1].FromDate 2017-09-26 12:00:00 AM BarsArray[1].ToDate 2018-07-12 12:00:00 AM BarsPeriodType.Day Day

        Here are the exact steps to reproduce it:
        1. Place the provided script inside of ..\Documents\NinjaTrader 8\bin\Custom\Indicators
        2. Go to New>Chart
        3. Select Minute for Type and 15 for value.
        4. Set "Load data based on" to "Bars"
        5. Set Bars to load to 200
        6. Click OK
        7. Apply the provided indicator.
        8. Observe the output window.


        I look forward to assisting further.
        Attached Files
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Great idea ChrisL. New chart works.



          Creating a new chart then adding my indicator to it does give me 200 and 200 bars for both as opposed to 200 and 9 bars. My existing workspace, MA, and charts still don't give 200 and 200.



          So now the puzzle is why are the existing workspace, MA, and charts not updating when I toggle the "load data based on" to bars and Bars to Load to 200?



          Could there be corruption in the workspace? So checking the workspace xml I find only <BarsToLoad>0</BarsToLoad>. Is this a problem? Shouldn't it have some value like 200?


          To redo my entire workspace from new will take time but more importantly would you like to get to the bottom of why existing workspace, MA, and charts don't toggle but the new chart works?


          Any ideas?

          Comment


            #6
            Hello sajosh,

            Thanks for the reply.

            I tried to reproduce this but every time I change an existing chart to load based on bars I am getting correct results.

            If you are not on version 8.0.14.2, please make sure to upgrade by going to Help>Download.

            Try to set your Bars To Load to 200, then restart NinjaTrader ensuring to save your workspace. If you still get the wrong output from the test script, then it could be your workspace. If that is the case then you would need to make new charts within that workspace or rebuild the workspace.

            Please let me know if I may be of any further assistance.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Hi ChrisL,


              Your clean script on a new MA on a new Workspace still gives 200 and 9 not 200 and 200 ...


              Instrument.FullName AA Bars.Count 200 Bars.FromDate 6/29/2018 12:00:00 AM Bars.ToDate 7/13/2018 12:00:00 AM BarsArray[0].BarsPeriod.BarsPeriodType Minute BarsArray[1].BarsPeriod.BarsPeriodType Day BarsArray[1].Instrument.FullName AA BarsArray[1].Count 9 BarsArray[1].DayCount 1 BarsArray[1].FromDate 6/29/2018 12:00:00 AM BarsArray[1].ToDate 7/13/2018 12:00:00 AM BarsPeriodType.Day Day



              I'm on 8.0.14.2.



              Can you try this on MA?

              Comment


                #8
                Hello sajosh,

                Thanks for the reply.

                Could you please post your workspace file so I can try to reproduce this?

                The file can be found under:

                ..\Documents\NinjaTrader 8\workspaces

                I look forward to your reply.
                Chris L.NinjaTrader Customer Service

                Comment


                  #9
                  So nice of you to test, ChrisL.


                  Use a new blank workspace, new blank MA then apply your script to it.

                  Comment


                    #10
                    Hello sajosh,

                    Thanks for the reply.

                    I did this procedure and I am still loading 200 bars for each data series. This could be your data provider, although most data providers should supply a good number of daily bars. The output you are getting looks like "Load data based on" is still set to "days " in your data series menu. Can you tell me what data provider you are using so I can test that out?

                    I look forward to your reply.
                    Chris L.NinjaTrader Customer Service

                    Comment


                      #11
                      You tested on a new market analyzer?



                      All connections are off. All the data I need is already available.


                      This works on charts but not MA.


                      Any ideas?

                      Comment


                        #12
                        Hello sajosh.

                        Thanks for the follow-up.

                        I tested on a Market Analyzer and I do get the same results as you do. Only a few daily bars with 200 bars of the primary instrument. I will go ahead and report this to our product management team.

                        Thanks in advance for your patience.
                        Chris L.NinjaTrader Customer Service

                        Comment


                          #13
                          Great. Glad I can help NT.


                          There's another small issue with MA. When creating a new MA column, the Properties > Set up > Label doesn't get reflected into the Configured list until another field is clicked.


                          Then sometimes I've even seen that field (in Configured) get undone so I have to manually go back and retype then change another field.


                          This happened when I changed "Load data based on" from Days to Bars.

                          Comment


                            #14
                            Hello sajosh,

                            Thanks for the reply.

                            I can not reproduce the issue described in your last post. If you could list the exact steps to reproduce it I will be happy to try it again.

                            I look forward to your reply.
                            Chris L.NinjaTrader Customer Service

                            Comment


                              #15
                              Sure, here ...


                              Open MA, double click to add indicator, double click Label, change to Hello, press tab


                              You should now see "Hello on 1 Minute Data" in Configured (To me this is problem 1)


                              Now enable Show in total row (or change any other fields)



                              You should now see "Hello" in Configured (To me this is problem 2)

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by maybeimnotrader, Today, 05:46 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post maybeimnotrader  
                              Started by quantismo, Today, 05:13 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post quantismo  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              8 responses
                              166 views
                              0 likes
                              Last Post jeronymite  
                              Started by cre8able, Today, 04:22 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post cre8able  
                              Started by RichStudent, Today, 04:21 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post RichStudent  
                              Working...
                              X