Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy No Longer Works - Error calling 'OnBarUpdate' method for strategy

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

    Strategy No Longer Works - Error calling 'OnBarUpdate' method for strategy

    Hi all,

    I've been testing out my strategy now for a couple of months, but when I opened up my chart today and added my strategy, it was not plotting my entry signals on my chart.

    I checked the log and see the following error:
    Error on calling 'OnBarUpdate' method for strategy 'MyStrategy': Object reference not set to an instance of an object.


    My strategy was working last Friday and I did not make any changes to it, so I'm not sure what the issue is?

    I couldn't find any threads with the same error that I am getting.

    Help would be greatly appreciated!

    Thanks,
    Andrew

    #2
    Andrew,

    Please see this tip article here: http://www.ninjatrader-support2.com/...ead.php?t=4226
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh,

      Thanks for the reply.

      I have been trying to add some logic to check for nulls, but have not had any luck yet (same error).

      Why would the nulls start causing an error after all of this time without any changes to the script? Could there be another issue other than not checking an object for a null value?

      AC

      Comment


        #4
        Could be. Only way to find out is to use try-catch blocks and isolate out exactly which line is causing problems.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Error on calling 'OnBarUpdate' method for indicator

          Hi,
          my strategy was running fine this morning, then had to restart NT7 because it crashed and now my log is showing the following error:

          Error on calling 'OnBarUpdate' method for indicator 'PairsCorrelation' on bar 1: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

          I made sure to set Min. bars required much higher than what my strategy is calling for - what else could be causing this??
          thx

          Comment


            #6
            nightriderx,

            The message is coming from your indicator, not your strategy. You will need to debug that particular indicator with try-catch blocks to find where it is accessing an index value that doesn't exist.
            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
            647 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            369 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            572 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            573 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X