Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on calling "on position update"

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

    Error on calling "on position update"

    Hello Community,
    First post here and a relatively new member here as well.

    I received the following error upon when attempting to load a new strategy my developer created. The issue I am running into is that it works without any issues on his local pc. The issue only arises when I attempt to run it on my machine. Anyone run into this sort of issue before?
    "Error on calling 'OnPositionUpdate' method on bar 382: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart."

    #2
    Welcome to the forums mcharoth!

    Resolving the error involves reproducing it and taking debugging steps to identify where the error is being thrown and then to check the index used on that line of code that is our of range.

    It may help if you can identify the exact settings needed to reproduce the error, and you can also consider sending the developer the same data you are testing with.

    Export data - https://ninjatrader.com/support/help...?exporting.htm

    If you are not able to show the developer how to reproduce the issue so they can take debugging steps, they may want to consider connecting to your PC to see how the issue is reproduced exactly so they can test on their end, or to give you a script that has debug output added.

    Debugging tips - https://ninjatrader.com/support/help...script_cod.htm

    The article below touches on index out of range errors when referencing Series objects when we have not processed that many bars in a data series, but the error could also be trigger from referencing an array.

    Making sure there are enough bars in the data series you are accessing - https://ninjatrader.com/support/help...nough_bars.htm

    If the developer has questions on what they could do to be able to troubleshoot that error, they are welcome to ask our Scripting Support team here, or at scriptingsupport [at] ninjatrader [dot] com.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    576 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    553 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X