Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on calling 'OnBarUpdate' method

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

    Error on calling 'OnBarUpdate' method

    Hi,

    I get the following:

    **NT** Error on calling 'OnBarUpdate' method for strategy 'Abcd/3083268d6bc444d6affefde48d92234e': Object reference not set to an instance of an object.

    Nothing shocking there except the entire body of the OnBarUpdate method is in a try/catch. This would seem to indicate the error is not within my code as this error message is not coming from my catch.

    Any thoughts/suggestions will be appreciated.

    Best Regards,
    Scott

    #2
    Scott,

    Could you possibly show more of your code here?
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Adam,

      All it would show is the override to OnBarUpdate with try...catch. All of my code is within the try catch and the message is not coming from the catch. Even if a method, indicator, etc. were called from OnBarUpdate and that method produced an error, the try catch would catch the error (I have a Print statement there).

      Comment


        #4
        Scott,

        Without code to look at I am not really able to assist further. I have no idea why you are getting this error message without seeing the code, especially since we would need to also check the Initialize() method and your variable declarations to ensure that you are initializing them properly.

        This error message means that there is some object not getting initialized before the code is trying to access it.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Adam,

          I understand, I posted it more as information for others who might do a search on this than anything. I have been a professional programmer for a very long time and have worked with NinjaTrader for years so I am clear on what the message is.

          The issue is very simple, I have literally every line of code within OnBarUpdate inside a try/catch and that is not where the error is coming from or the catch would, well, catch it.

          I appreciate your input; thanks for your time on this. One thing that can be frustrating is when something like this happens and you don't know others have had the same problem.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          67 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          36 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          61 views
          1 like
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          62 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          53 views
          0 likes
          Last Post CarlTrading  
          Working...
          X