Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on calling 'OnBarUpdate' method on bar

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

    Error on calling 'OnBarUpdate' method on bar

    I'm backtesting 30 days of data using the backtest type "Optimization." When I use 30 days of data it says, Error on calling "OnBarUpdate' method on bar 1: Object reference not set to an instance of an object.

    Can someone help me understand what this means and how to fix it? Thanks.

    #2
    Hello AdeptistJune,

    Thanks for your post.

    The message "object reference not set to an instance of an object" means that you are referring to an object the does not exist.

    To determine what the source of the error is you will need to debug your strategy. This is typically done with print statements added to your code to send a print output to the New>Ninjascript Output window. As you do not know where the error is, you would add a print statement every few lines of code and then observe the output window when you apply the strategy. The last print statement value shown in the output window would indicate the error occurs after that print statement, you can then add further print statements to zero in on the offending code.

    Here is a link to our tips on debugging: https://ninjatrader.com/support/help...script_cod.htm

    Does the error occur when you perform a normal backtest of the exact same data?



    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    23 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    120 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    63 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    45 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X