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 DawnTreader, 05-08-2024, 05:58 PM
            13 responses
            44 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by jpeep, 08-16-2020, 08:31 AM
            15 responses
            497 views
            0 likes
            Last Post notenufftime  
            Started by ldanenberg, Yesterday, 03:19 PM
            2 responses
            12 views
            0 likes
            Last Post ldanenberg  
            Started by joselube001, Today, 12:17 PM
            2 responses
            12 views
            0 likes
            Last Post joselube001  
            Started by arangocj, Today, 12:37 PM
            1 response
            20 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X