Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem: can't use external data during playback as AddDataSeries()

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

    Problem: can't use external data during playback as AddDataSeries()

    I get an error message: Error on requesting bar series: "Unknown instrument 'GB10Y'" when trying to use the Playback connection.

    GB10Y is an instrument that I added manually.
    GB10Y is the symbol listed in in the Symbol Map for "External" as well as "Playback"
    GB10Y is listed in Historical Data - GB10Y / Last / Minutes / February 2021 / 2/11/2021
    GB10Y works when I create a chart and use GB10Y as an instrument

    The issue (as I see it)

    My instrument manually adds the instrument to an indicator.

    AddDataSeries(symbol, BarsPeriod.BarsPeriodType, BarsPeriod.BaseBarsPeriodValue);

    Should this work?

    Maybe I need to have more data there for playback?

    i.e. maybe I need the following

    GB10Y
    Ask
    Minute
    Tick ? tick too?
    Bid
    Minute

    I have GB10Y
    Last
    Minute

    and this is the only data that I use?

    #2
    Hello ntdev,

    This may be happening if you did not also set the Simulator in the instrument definition so that the replay account can be used, did you also set Simulator to GB10Y?

    I look forward to being of further assistance.

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      did you also set Simulator to GB10Y?
      Yes, I did.

      Click image for larger version

Name:	GB10Y_Settings.jpg
Views:	276
Size:	99.9 KB
ID:	1141652

      Comment


        #4
        I also recall that there are some issues with dynamically added data series but this doesn't seem to apply to me.

        In https://ninjatrader.com/support/foru...r-optimization NinjaTrader_Jim said..

        Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result in an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner.
        In my case there is no problem with the variables being reliable so hopefully that isn't the issue but I have seen this error when adding data series that weren't yet loaded, like the December 2022 contract of something. But after opening a new chart with this instrument then refreshing the chart that called AddDataSeries() everything would work. Hard-coded or not, this specific issue seems to be a BUG and/or limitation of NT -- it appears that NT doesn't have the ability to pause the thread and load extra data during the OnStateChange(State.Configure).

        >> Could that bug/limitation be related?

        I would not think so because nothing needs to be loaded in my case because the data files exist for GB10Y...

        \Documents\NinjaTrader 8\db\minute\GB10Y\20210211.Last.ncd
        \Documents\NinjaTrader 8\db\minute\GB10Y\20210210.Last.ncd
        \Documents\NinjaTrader 8\db\minute\GB10Y\20210209.Last.ncd
        Last edited by ntdev; 02-13-2021, 01:56 AM.

        Comment


          #5
          Hello ntdev,

          Thanks for the update.

          Just to clarify about the dynamic AddDataSeries, if you use variables in your samples our support is going to suggest hard coding it as a first step which I know is repetitive. We don't have a list of where that will and won't work so its best to just completely avoid using that for any type of tests or samples. If you find that it works in your use cases for your own projects feel free to use it, that is just not helpful in debugging situations.

          it appears that NT doesn't have the ability to pause the thread and load extra data during the OnStateChange(State.Configure).
          If you have a sample that demonstrates that we can look further into that, otherwise this would not be the case.

          I did try this on my end and had seen the error you did when not using Simulator for the symbol mapping. Have you confirmed that you do not have a duplicate instrument in the instrument manager and have you tried to disconnect, delete the instrument and re create it, reconnect and re create the chart?

          How was the data acquired for playback for this instrument? Did you record live data or is this some other data which was patched in to let the instrument work in playback as a test?


          I look forward to being of further assistance.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          597 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          343 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          556 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          555 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X