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

Failed to call 'Add' method: System.NullReferenceException

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

    Failed to call 'Add' method: System.NullReferenceException

    Failed to call 'Add' method: System.NullReferenceException: Object reference not set to an instance of an object. at NinjaTrader.Data.BarsSeries.GetTime(Int32 index) at NinjaTrader.Data.Bars.GetTime(Int32 index) at NinjaTrader.NinjaScript.NinjaScriptBase.Update(Int 32 idx, Int32 bip) at NinjaTrader.NinjaScript.NinjaScriptBase.<>c__Displ ayClass181_2.<TickReplayOrUpdate>b__2(Object s, BarsUpdateEventArgs o) at NinjaTrader.Data.BarsSeries.Add(Bars bars, Double open, Double high, Double low, Double close, DateTime time, Int64 volume, Double tickSize, Boolean isBar, Double bid, Double ask)

    I think it has something to do with an multi time frame indicator I have loaded on the chart. It doesn't give this issue with ES / NQ, just CL
    Attached Files

    #2
    Hello habibalex,

    Thanks for writing in.

    The log and trace show this error occurs when the "working" workspace gets loaded, but further troubleshooting steps will be needed to identify where the null reference is coming from. Seeing this only with CL provides a good hint to investigate further. I also see that you are on an older version of NinjaTrader 8.

    Could you confirm that the issue is still evident after upgrading NinjaTrader to 8.0.13.1 and performing an Instrument Reset and Rollover?

    Upgrade installers can be found here: https://ninjatrader.com/PlatformDirect

    Performing an Instrument Reset and Rollover can be done from the Control Center under Tools > Database Management. Future expires should be checked along with Symbol Mappings and General Properties. Update can then be pressed to reset instruments. After this, you may rollover by clicking the Rollover button in the same Database Management window.

    If the issue is still evident after these steps, I would advise to troubleshoot the workspace by taking a bottom up or top down approach to narrow down what indicator and line of code is throwing the exact issue. (A top down approach involves removing items from the workspace until the issue disappears, while a bottom up approach involves recreating your workspace starting from a blank starting point until the issue reappears.)

    I look forward to being of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Your suggestions helped but now the problem has popped up again. It's occurring in all the instruments I look at now, ES, CL, and NQ.

      If I disable tick replay, the problem seems to go away. Basically the secondary series is causing a null reference problem with Tick Replay checked. While creating the bartype, the bars object is null in the barstype. What is the solution to this problem?

      Comment


        #4
        Hello habibalex,

        If the issue is related specifically to a NinjaScript and the way it is programmed, we may need to look at a reduced example together to better understand the issue and what would need to be done to fix it.

        Could you provide a reduced example script that exhibits this issue and some steps I could take to hit the error so we can investigate further?

        I have also included some steps that can be taken to see if the issue occurs in a clean environment. Could you also verify that the issue exists with the script in the clean environment?

        Clean environment test:

        Creating a clean environment can be done by following the steps below:
        1. Close NinjaTrader 8, and rename the "NinjaTrader 8" folder in My Documents to something like: "NinjaTrader 8 OLD"
        2. Uninstall NinjaTrader from the Windows Control Panel and reinstall using the installer from http://ninjatrader.com/PlatformDirect
        3. Start the new clean instance of the platform and import the NinjaScript in question and test for issues.


        If you ever need to switch back to your original platform, you may do so by closing NinjaTrader and swapping the platform folder names. For example, Close NinjaTrader and rename the new "NinjaTrader 8" folder to "NinjaTrader 8 NEW" and the "NinjaTrader 8 OLD" folder to "NinjaTrader 8." Then restart the platform. Simply put: NinjaTrader 8 will always load the "NinjaTrader 8" folder in My Documents.

        Thanks in advance, I'll be happy to work with you further on this matter.
        JimNinjaTrader Customer Service

        Comment


          #5
          I created a clean environment but neither the OLD or clean one show errors today. I will update when they show up again. I'll create the minified script and send it to you when that happens
          Last edited by habibalex; 05-03-2018, 11:58 AM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by inanazsocial, Today, 01:15 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by rocketman7, Today, 02:12 AM
          0 responses
          6 views
          0 likes
          Last Post rocketman7  
          Started by dustydbayer, Today, 01:59 AM
          0 responses
          1 view
          0 likes
          Last Post dustydbayer  
          Started by trilliantrader, 04-18-2024, 08:16 AM
          5 responses
          23 views
          0 likes
          Last Post trilliantrader  
          Started by Davidtowleii, Today, 12:15 AM
          0 responses
          3 views
          0 likes
          Last Post Davidtowleii  
          Working...
          X