Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unhandled Exception: Object reference not set to an instance of an object.

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

    Unhandled Exception: Object reference not set to an instance of an object.

    I've started getting this error the last few days whenever I load my main Workspace: Unhandled Exception: Object reference not set to an instance of an object. - It seems to be accompanied by NinjaTrader not saving my strategies applied to charts - so when I restart the program, the "Strategies" tab on the main/home window for NT is blank, even though when I saved it there were several strategies applied - help finding the solution to this would be greatly appreciated - the strategy I'm running has been made through the strategy builder and I'm not aware of having made changes elsewhere in the program -

    Thank you -

    #2
    Hello Daveman0,

    I would suggest to try and isolate the problem here, the error is preventing the workspace from being loaded however the error does not say what item.

    Please try doing the following:
    1. Close all workspaces so that you are in a new empty workspace.
    2. Apply the strategy to a chart which has nothing else applied and then save the workspace as a new workspace.
    3. Close the workspace
    4. Re open the workspace

    If that still gives the error and no other items were used besides the strategy that helps to confirm something is happening with that file, if that does not produce the error then something else in your templates/normal workspace is having an issue.

    Strategies not being applied is generally just that the workspace failed to load so it may not be related to your item.

    Another item to try here would be to repair the database:
    1. Disconnect NinjaTrader from any open connections via Control Center > Connections > Disconnect
    2. From the NinjaTrader Control Center window select the menu Tools > Database Management
    3. Click on 'Repair DB'
    4. Press the "Repair" button

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello Daveman0,

      I would suggest to try and isolate the problem here, the error is preventing the workspace from being loaded however the error does not say what item.

      Please try doing the following:
      1. Close all workspaces so that you are in a new empty workspace.
      2. Apply the strategy to a chart which has nothing else applied and then save the workspace as a new workspace.
      3. Close the workspace
      4. Re open the workspace

      If that still gives the error and no other items were used besides the strategy that helps to confirm something is happening with that file, if that does not produce the error then something else in your templates/normal workspace is having an issue.

      Strategies not being applied is generally just that the workspace failed to load so it may not be related to your item.

      Another item to try here would be to repair the database:
      1. Disconnect NinjaTrader from any open connections via Control Center > Connections > Disconnect
      2. From the NinjaTrader Control Center window select the menu Tools > Database Management
      3. Click on 'Repair DB'
      4. Press the "Repair" button
      Looks like the database repair did the trick - thank you very much for the quick response!

      Comment


        #4
        In a nutshell it means.. You are trying to access an object without instantiating it.. You might need to use the "new" keyword to instantiate it first i.e create an instance of it. An Object is an instance of a Class , it is stored some where in memory. A reference is what is used to describe the pointer to the memory location where the Object resides. The message "object reference not set to an instance of an object" means that you are referring to an object the does not exist or was deleted or cleaned up. It's usually better to avoid a NullReferenceException than to handle it after it occurs. To prevent the error, objects that could be null should be tested for null before being used.

        if (mClass != null)
        {
        // Go ahead and use mClass
        mClass.property = ...
        }
        else
        {
        // Attempting to use mClass here will result in NullReferenceException
        }

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        61 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        134 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X