Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on calling ‘OnBarUpdate’

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

    Error on calling ‘OnBarUpdate’

    Hello!

    I created a custom strategy and I decided to look at the Log Tab in the Control Center.

    I noticed I am getting this error among other alerts:

    Error on calling ‘OnBarUpdate’ method for strategy ‘myStrategy/guid’: Object reference not set to an instance of an object.

    Questions: Whats causing this and how do I correct or debug it?

    Thank you for anything!
    Robert

    #2
    Hello Robert,

    Thanks for your post.

    To debug we recommend using print statements through your code to see what section causes the issue, then once identified using further print statements to isolate to the line that is the source of the issue. We have put together a guide to debugging here: http://ninjatrader.com/support/forum...ead.php?t=3418
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Paul,

      I use Print statements extensively to debug. This issue happens intermittently. I need a lower level of visibility.

      Robert

      Comment


        #4
        Hi Robert,

        Thanks for your reply.

        What do the print statements tell you?

        Is the issue happening when you place an order or adjusting a position?

        Can you provide any further information?
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Paul View Post
          What do the print statements tell you?
          Print Statements are not going to tell us why both of our machines are "intermittently" failing. Additionally, back-testing works perfectly.

          Originally posted by NinjaTrader_Paul View Post
          Is the issue happening when you place an order or adjusting a position?
          When the strategy is running. Orders are placed automatically.
          Originally posted by NinjaTrader_Paul View Post
          Can you provide any further information?
          I have posted the error. I'm asking how I can debug this at a lower level. Using "Print" isn't going to give us the granularity we need.

          Comment


            #6
            Hello RobVig,

            Thank you for your response.

            There is nothing more "granular" for debugging here. You can use try-catch blocks to try to catch any exceptions, but there is nothing beyond standard debugging that you would use here.

            The message indicates an object is not assigned when you attempt to access it. Look to your variables, your DataSeries, any Lists, and IOrder objects. It takes an understanding of your script to understand what the message may be referring to.

            Please refer to the following link for information on Try-Catch blocks: http://ninjatrader.com/support/forum...ead.php?t=9825
            Don't forget to review the debugging tips either: http://ninjatrader.com/support/forum...ead.php?t=3418

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by stafe, 04-15-2024, 08:34 PM
            10 responses
            42 views
            0 likes
            Last Post stafe
            by stafe
             
            Started by frslvr, 04-11-2024, 07:26 AM
            8 responses
            111 views
            1 like
            Last Post NinjaTrader_BrandonH  
            Started by rocketman7, Today, 09:41 AM
            3 responses
            8 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by traderqz, Today, 09:44 AM
            2 responses
            5 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by rocketman7, Today, 02:12 AM
            7 responses
            31 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X