Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Null Reference exception during optimization

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

    Null Reference exception during optimization

    Code:
    System.NullReferenceException was unhandled
    Message: An unhandled exception of type 'System.NullReferenceException' occurred in mscorlib.dll
    Additional information: Object reference not set to an instance of an object.
    got this when doing optimization on a strategy.


    settings...

    using default optimizer on profit factor

    and call Stack
    Last edited by aufidius; 07-28-2015, 06:21 PM.

    #2
    I was worried that maybe something got corrupted in my migration of NT7 to NT8 data so I reinstalled and didn't import my NT7 settings.

    Using EOD data from Kinetic i'm getting the same error from the MACross strategy.

    Comment


      #3
      anyone else getting this?

      Comment


        #4
        We've had a view similar reports. Can you please try putting the following in State.SetDefaults

        Code:
        protected override void OnStateChange()
        {
             if (State == State.SetDefaults)
             {
                  // Set to true for debug purposes. If optimization results were off when this was set to false there
                  // likely is a user variable reset issue that needs to be addressed
                  IsInstantiatedOnEachOptimizationIteration = true;
             }
        }
        If this does not help, can you please email your log/trace files to platformsupport[at]ninjatrader[com]
        MatthewNinjaTrader Product Management

        Comment


          #5
          that resolved the issue.

          Comment


            #6
            Thanks for confirming, but you shouldn't necessarily need to do that to prevent such an error depending on how the strategy is coded. Can you send us a reproduction of the error to support at NinjaTrader dot com? We likely only need the OnStateChange logic if you can provide that logic at the minimum
            MatthewNinjaTrader Product Management

            Comment


              #7
              Bad news...

              Last night my machine upgraded from Windows 8.1 to Windows 10 and now I am unable to reproduce the error. All strategies work fine without the change mentioned earlier.

              Maybe the issue is related to specific versions of the .NET runtime? Either way if it happens again I'll email in the log data.

              Comment


                #8
                Interesting... well thanks for the update. We'll keep our eyes peeled as well.
                MatthewNinjaTrader Product Management

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Mindset, Today, 06:46 AM
                0 responses
                8 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by M4ndoo, Yesterday, 05:21 PM
                0 responses
                14 views
                0 likes
                Last Post M4ndoo
                by M4ndoo
                 
                Started by M4ndoo, 04-19-2026, 05:54 PM
                0 responses
                15 views
                0 likes
                Last Post M4ndoo
                by M4ndoo
                 
                Started by cmoran13, 04-16-2026, 01:02 PM
                0 responses
                82 views
                0 likes
                Last Post cmoran13  
                Started by PaulMohn, 04-10-2026, 11:11 AM
                0 responses
                48 views
                0 likes
                Last Post PaulMohn  
                Working...
                X