Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Object reference not set to an instance of an object

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

    Object reference not set to an instance of an object

    All my strategies - no matter which one (even the simplest) throw this error:

    Error on calling 'OnOrderUpdate' method for strategy '[strategy name]/[hexcode]': Object reference not set to an instance of an object.

    Before I get the usual 'it must be your code' response - all of those strategies are running fine in 6.5. All I did was to change the Token comparisons to order comparisons (as suggested in the guide), renamed Category to GridCategory, and changed Action to OrderAction. Recompiled and trying to run them but get the error above.

    I see the strategy executing a few times when I load it but eventually it fails with that error. Has anyone else run into this one? If so, what's the fix? I was hoping that a new update had been posted after two weeks but thus far I don't see anything on the download page.

    Cheers,

    Mole

    #2
    I also have a similar issue with a script which runs well on 6.5, but when migrated to NT7 gives the following message - Failed to execute DB job 'StrategyUpdateJob': There was an error generating the XML document.: Object reference not set to an instance of an object.

    Any suggestions?

    Comment


      #3
      Maybe you're still checking for ".Token"s. These Tokens are no longer part of the code framework in NT7.

      If you had

      if (Sausage.Token == order.Token)
      {Print("I like sausage.");}

      before, it should now be

      if (Sausage == order)
      {Print("I like sausage.");}

      Comment


        #4
        molecool,

        Please provide code. Thank you.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          molecool,

          Please provide code. Thank you.
          We keep going through that exercise - LOL - I really can't provide you with the code as it's a very successful and proprietary strategy.

          Is there something I could be logging for you? I'm willing to help you guys kill those bugs but I can't disclose my proprietary algos and such. Please advise.

          Comment


            #6
            Originally posted by noincomenojobnoassets View Post
            Maybe you're still checking for ".Token"s. These Tokens are no longer part of the code framework in NT7.

            If you had

            if (Sausage.Token == order.Token)
            {Print("I like sausage.");}

            before, it should now be

            if (Sausage == order)
            {Print("I like sausage.");}
            Not in my case - as described below I am not comparing tokens.

            Comment


              #7
              molecool

              try looking in your log file for the error- that might at least tell you what object is throwing the error.

              eg

              2009-11-30 08:08:47:763 in OnUnhandledApplicationException
              2009-11-30 08:08:47:763 ********* exception trapped *********
              2009-11-30 08:08:47:763 Order quantity has to be greater than 0

              Comment


                #8
                molecool,

                Suggest you strip down all proprietary algo parts and just leave absolute bare necessities to reproduce. Then we can help you evaluate. Otherwise we are all shooting in the dark here.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by Mindset View Post
                  try looking in your log file for the error- that might at least tell you what object is throwing the error.

                  eg

                  2009-11-30 08:08:47:763 in OnUnhandledApplicationException
                  2009-11-30 08:08:47:763 ********* exception trapped *********
                  2009-11-30 08:08:47:763 Order quantity has to be greater than 0
                  As I said - the strategy works fine in 6.5, so it's not some type of oversight like that.

                  Comment


                    #10
                    I get the same error

                    I am trading beta 4 live cash via Zen-Fire for the last 3 days without any execution problem, however I get the error message too often

                    I have not been able to determine what is not being completed due to the error.

                    Here is the print in the trace file for this morning's live trade and only error:

                    Instrument='NQ 12-09' Action=Buy Limit price=0 Stop price=1782 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
                    2009-12-01 09:29:21:608 (Zen-Fire) Cbi.OrderStatusEventArgs.Process: Order='4deae81ec8f542fa8d98bd56a01ed17f/...my acct...!AMP' Name='Entry' New state=Initialized Instrument='NQ 12-09' Action=Buy Limit price=0 Stop price=1782 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
                    2009-12-01 09:29:21:610 ERROR: Error on calling 'OnBarUpdate' method for strategy 'TTT_AutoEntry_NT7_beta_2/661afb72744c4e57852292702b83b9d8': Object reference not set to an instance of an object.

                    Comment


                      #11
                      For what it's worth, 6.5 is not a valid comparison when talking about scripts in 7. There have been changes and just because it worked in 6.5 does not guarantee it will work in 7.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        ATI user,

                        Please try some try-catch blocks. We will need simple as possible reproducible code to evaluate these scenarios.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_Josh View Post
                          For what it's worth, 6.5 is not a valid comparison when talking about scripts in 7. There have been changes and just because it worked in 6.5 does not guarantee it will work in 7.
                          I can respect that and would agree. However, it does not help me address my immediate problem ;-)

                          Comment


                            #14
                            Originally posted by NinjaTrader_Josh View Post
                            molecool,

                            Suggest you strip down all proprietary algo parts and just leave absolute bare necessities to reproduce. Then we can help you evaluate. Otherwise we are all shooting in the dark here.
                            That makes sense - will work on that over the weekend and shoot something out to you. Do you have an email addy I can send it out to?

                            Comment


                              #15
                              You can send it to support [at] ninjatrader [dot] com with Attn: Josh in the subject. Please also include a link to this thread. Thank you.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              599 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              344 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
                              558 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              557 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X