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 Ashkam, 04-29-2024, 09:28 AM
            4 responses
            43 views
            0 likes
            Last Post Ashkam
            by Ashkam
             
            Started by nightstalker, Yesterday, 02:05 PM
            1 response
            29 views
            0 likes
            Last Post NinjaTrader_Eduardo  
            Started by dcriador, Today, 02:09 PM
            0 responses
            7 views
            0 likes
            Last Post dcriador  
            Started by nicthe, Today, 07:38 AM
            4 responses
            22 views
            0 likes
            Last Post bltdavid  
            Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
            30 responses
            98 views
            0 likes
            Last Post cmtjoancolmenero  
            Working...
            X