• 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

AddDataSeries Number of bars 6 charts/timeframes

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

    AddDataSeries Number of bars 6 charts/timeframes

    I am struggling to work with the limitations of AddDataSeries. Can someone clarify if this is correct. I have 6 charts displayed on a screen. 5 m, 30m, 60m, daily, weekly, monthtly all using candlestick type, displaying the same symbol. I have a time frame continuity indicator that shows those time frames in the top right of each chart(screen attached). It very simply displays the time green or red if its up or down since the open. If I want this to work on all 6 charts, I need to load: 8,920(ish) bars because that's how many 5 min candles (my lowest time frame) are in a month (my highest time frame).

    First, is my understanding right about right? Second if anyone has a clever way to load a new bar type so I can overload the data series # of bars per time frame, or specific code placements tips so it does not calculate more than they needed for each time frame, etc. in an attempt to make this relatively light indicator without bogging it down with an inordinateamount of bars that I only need for a simple calculation. It seems my best course would be loading a different bar type so I can use the overload feature of AddDataSeries, but that is where my knowledge tops out as a new NT user.

    Thanks for any help!

    Image image hosted in ImgBB

    #2
    Hello UncleRyan,

    A script will not start processing data until all series have at least one bar.

    This does mean that you would need to load the same amount of data on all of the series no matter the size or interval.

    While this can load more data than you really need, there isn't a work around for this when using AddDataSeries() and the data will need to load in the entirety.

    With a BarsRequest, this would allow you to pull data out of sync and manipulate this data how you would like, however note that data cannot be supplied to indicators.
    https://ninjatrader.com/support/help...arsrequest.htm
    https://ninjatrader.com/support/foru...518#post742518

    The AddDataSeries() method does have a barsToLoad method but this only works when selecting a different instrument.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      According to the manual:
      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.

      From this I would interpret that I could load - say a OHLC bar of the same instrument and that would allow me to use barstoload.or there is no way with the same instrument?

      Lastly - even when I load enough bars I often get the error that's basically "you tried to reference 5 when you only loaded 4".. If I know I am loading enough bars what would this tend to indicate?

      Thanks

      Comment


        #4
        Hello UncleRyan,

        Thanks for your reply.

        Well, OHLC is a chart style in Ninjatrader and not a bar type. It would need to be a bar type as found in the Type field of the data series window.

        "Lastly - even when I load enough bars I often get the error that's basically "you tried to reference 5 when you only loaded 4".. If I know I am loading enough bars what would this tend to indicate?" This error has no bearing on the amount of bars loaded by the data series. It relates to the sequence of bars that the script is processing. All scripts will start on the very first bar in the data series and will execute your code on each bar in sequence up to the latest bar in the series. If on the first historical bar you try to access a previous bar then the script does not know of a previous bar and will produce that type error. The same thing would be true at any time you access a previous bars ago that exceeds the first bar of the data, for example on the 100th bar if you try to access a bar ago of 101 you would get that error. You would need to review your code for what bars ago you are accessing and when and then adjust your script by using a CurrentBars check to ensure that your script does not process until that number of bars have been processed above the current bars check. Please see the help guide here: https://ninjatrader.com/support/help...urrentbars.htm

        To gain a better overview of multi time frame considerations, please take the time to review: https://ninjatrader.com/support/help...nstruments.htm
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thanks a lot, Paul - that was very helpful!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by rubnnderinslo, Today, 09:43 PM
          0 responses
          3 views
          0 likes
          Last Post rubnnderinslo  
          Started by kirkvan, Today, 09:03 PM
          0 responses
          7 views
          0 likes
          Last Post kirkvan
          by kirkvan
           
          Started by hedgeplay, Today, 08:35 PM
          0 responses
          5 views
          0 likes
          Last Post hedgeplay  
          Started by jaboo, Today, 06:38 PM
          0 responses
          12 views
          0 likes
          Last Post jaboo
          by jaboo
           
          Started by 7robert, Today, 06:05 PM
          0 responses
          15 views
          0 likes
          Last Post 7robert
          by 7robert
           
          Working...
          X