Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by mjairg, 07-20-2023, 11:57 PM
    3 responses
    213 views
    1 like
    Last Post PaulMohn  
    Started by TheWhiteDragon, 01-21-2019, 12:44 PM
    4 responses
    544 views
    0 likes
    Last Post PaulMohn  
    Started by GLFX005, Today, 03:23 AM
    0 responses
    3 views
    0 likes
    Last Post GLFX005
    by GLFX005
     
    Started by XXtrader, Yesterday, 11:30 PM
    2 responses
    12 views
    0 likes
    Last Post XXtrader  
    Started by Waxavi, Today, 02:10 AM
    0 responses
    7 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Working...
    X