Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaTrader crashes at the end of a backtest

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

    NinjaTrader crashes at the end of a backtest

    I try to test one of my strategies and NT crashes at the end. It happens right after I see the backtest results. The error in the log is: Unhandled exception: Exception has been thrown by the target of invocation.

    Is there a way to trace that exception and see if it's thrown by my code?

    Also, not sure if it's related, when I start NT, I see this error in the log about my strategy:

    Error in loading strategy from the database: System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at NinjaTrader.NinjaScript.StrategyBase.DbFromCommand (IDbCommand cmd)

    What part of my code is executed at the time of loading?


    Thanks

    #2
    Hello,

    Thank you for the question.

    The portions of the code that would be executed at loading would be Initialize and OnStartUp but it would be hard to say based on what is provided where the problem may be.

    I would suggest first setting up a few tests to narrow the search.

    A first basic test would be to ensure it is your code causing the crash, you could test using the same parameters on the SampleMACrossOver to see if that can display results successfully. In the case it can, you could further test your script by commenting all of the logic out so it is just a shell. Run it and ensure the platform can stay open to know there is a portion of logic associated with the crash.

    If you complete both of these steps and it leads to the logic, likely the easiest way to debug this would be to comment out sections of logic and run the test until you find the logic that controls the actual crash. With that information we could review just that logic to see why exactly it is crashing.

    The errors provided do not point to anything specific, but the OutOfRange exception would certainly cause the script to stop, regarding the crash only the syntax would tell us why that is happening.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by andrewtrades, Today, 04:57 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by chbruno, Today, 04:10 PM
    0 responses
    6 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    436 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    7 views
    0 likes
    Last Post FAQtrader  
    Started by rocketman7, Today, 09:41 AM
    5 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X