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

Index out of bounds while running the optimizer

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

    Index out of bounds while running the optimizer

    Hello,

    I have a problem while running the optimizer on my strategies.

    I randomly get errors like this : Strategy 'X': Error on calling 'OnBarUpdate' method on bar X: Index was outside the bounds of the array.

    As I said, those errors happens randomly. The bar number that causes the error always changes between optimization (even with identical optimization parameters), and sometimes there are no errors at all (optimization runs fine and returns the results).

    Also, I never get these errors while backtesting or while running my strategies live.

    I searched the forum, and found this post : https://ninjatrader.com/support/foru...x-out-of-range
    However, the solution mentioned in there didn't solve my problem.

    Did anyone ever experienced this problem? Do anyone know why those errors could be so random?

    Thank you,
    Alexis

    #2
    Hi Alexis, thanks for your post.

    This would happen because some aspect of your script is accessing an array index that is not there. E.g. If you run an optimization with parameters that get used to index an array like X 1;20;1,
    If its bar 0 and the script accesses Close[X] where X = 1 you would get this problem. You can also try this with Visual Studio Debugging to break when a .NET exception occurs:
    https://ninjatrader.com/support/help..._debugging.htm

    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by JTizz, Today, 03:32 PM
    1 response
    33 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by ebaydan777, Today, 02:41 PM
    1 response
    27 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by aligator, Today, 02:28 PM
    1 response
    27 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by daniel_weber8, Today, 01:21 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChristopherS  
    Started by jungsoohuh, Today, 12:07 PM
    1 response
    35 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Working...
    X