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

load more data with AddDataSeries() than in the chart

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

    load more data with AddDataSeries() than in the chart

    Hi, I try to access values older than those shown in the chart using the AddDataSeries() method in my chart (10 days loaded in chart).

    Click image for larger version

Name:	Screenshot_1.jpg
Views:	434
Size:	12.2 KB
ID:	1150097
    how can I load more days in the data series than in the chart? I try the following:

    Code:
    AddDataSeries(Instrument.FullName, new BarsPeriod { BarsPeriodType = BarsPeriodType.Day, Value = 1 }, [B][COLOR=#e74c3c]365[/COLOR][/B], TradingHours.Name, null);
    unfortunately only about as many days of data are loaded as shown in the chart, although I have specified 365 days


    Code:
    Print(BarsArray[1].Count);
    does not result in 365 but the same number as bars can be seen (loaded) in the chart. how can I load on the 365 days in the second data series?
    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Hi sidlercom80 ,thanks for writing in.

    I am able to load 365 days on my test script. I loaded up a 1 minute chart and, 5 days loaded for the primary series and loaded 365 days of daily bars. Could you test this out and check the output window?

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

    Comment


      #3
      Hi _ChrisL, thank you for your answer. up to the timeframe 60 minutes it goes, from 1 day no more, see pictures:

      Click image for larger version  Name:	Screenshot_3.jpg Views:	0 Size:	140.5 KB ID:	1150111Click image for larger version  Name:	Screenshot_2.jpg Views:	0 Size:	118.9 KB ID:	1150112

      any idea?

      I forgot I use:
      Code:
      Print(Times[1][0] + " " + BarsArray[1].Count);
      Last edited by sidlercom80; 04-05-2021, 10:54 AM.
      sidlercom80
      NinjaTrader Ecosystem Vendor - Sidi Trading

      Comment


        #4
        Hello, thanks for your reply.

        Are you connected to a data provider that is giving the NQ instrument? Try restarting the platform, connecting to your data provide and test the script again. There should be no issue with this method.

        Best regards.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Yes I`m connected, I also made a reboot. ;-)

          here is a small video: http://www.youtube.com/watch?v=KTelRMDZ-Mo

          anything higher than intraday, the set 365 days will not be loaded


          it seems as if it just doesn't work if the same timeframes are in the AddDataSeries AND chart.
          Last edited by sidlercom80; 04-05-2021, 11:30 AM.
          sidlercom80
          NinjaTrader Ecosystem Vendor - Sidi Trading

          Comment


            #6
            Hello sidlercom80, thanks for your reply.

            It's because you are using the same data series as the primary. You will need to load the number of days for the chart if you use a daily series on the chart. This is expected due to the note on the AddDataSeries page:

            When adding multiple Data Series of the same instrument and the same Bar Type, the 'barsToLoad' property will only be effective on the first added series. Subsequent series with a different barsToLoad setting will not load a different number of bars then the first series.

            Please let me know if I can assist any further.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Thank you for your explanation! I've probably read that over
              sidlercom80
              NinjaTrader Ecosystem Vendor - Sidi Trading

              Comment


                #8
                Hello Chris_L,

                I was able to get it working for my use case. However, I had to change the TradingHour.Name to "Default 24 x 7". While it works that's a hard coded value. Is this ok?

                Did a little guess work and came up with the value, Instrument.MasterInstrument.TradingHours.Name. This appears to work. Perhaps TradingHour.Name is deprecated​. Can this be confirmed?

                Secondly, is the 365 days the max value? Can this be larger? Practically it doesn't. I thought about making it user definable but the documentation said to avoid this. A 365 day max would cap how far out the indicator can make calculations, but I don't see anyone pushing the period past 50 days.

                Best regards,
                Unsutable
                Unsuitable
                NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

                Comment


                  #9
                  Hello Unsuitable,

                  This is fine to do, however note the session close times may not be what you expect, which can cause bars to form differently.

                  Are you looking for Bars.TradingHours.Name? ( or BarsArray[1].TradingHours.Name)


                  There isn't a limit to how much data can be requested, but this would be limited by the amount of data available from the provider.
                  With NinjaTrader Brokerage there is 1 year of tick data, minute data as far back as recorded (typically 10 years), and day data as far back as recorded.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by WHICKED, Today, 10:02 PM
                  0 responses
                  12 views
                  0 likes
                  Last Post WHICKED
                  by WHICKED
                   
                  Started by ngchun1, Today, 09:29 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post ngchun1
                  by ngchun1
                   
                  Started by ngchun1, Today, 09:25 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post ngchun1
                  by ngchun1
                   
                  Started by ngchun1, Today, 09:21 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post ngchun1
                  by ngchun1
                   
                  Started by Alaina19, Today, 09:17 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post Alaina19  
                  Working...
                  X