Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

debugging Market Analyzer unhandled exception

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

    debugging Market Analyzer unhandled exception

    I have a Market Analyzer template with multiple indicators that worked fine until I restarted NT. Now the MA window is empty and I get an "Unhandled exception: Index was outside the bounds of the array" error. I added a try/catch block around the entire OnBarUpdate method on the indicator I had been updating, recompiled, then restarted NT, but I still get the same error. If I create a new MA window and add my indicator it works fine. But the template still gives me the unhandled exception error if I attempt to add it to any MA window.
    My questions are:
    1) If I update an indicator and recompile, does the MA template use the updated indicator? ( It seems like my broken template is still retrieving old compiled indicator code, because I've added catch print statements to the NT output and control center but none of these statements appear)
    2) How can I track down exactly what's causing this exception? I've looked in the NT trace files and get 3 unhandled exceptions like this, but no specific data:

    =====================
    2020-04-13 08:38:31:898 *************** unhandled exception trapped ***************
    2020-04-13 08:38:31:899 Index was outside the bounds of the array.
    2020-04-13 08:38:31:904 System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at NinjaTrader.Gui.MarketAnalyzer.MarketAnalyzerGrid. Restore(XElement element, Boolean asTemplate)
    at NinjaTrader.Gui.MarketAnalyzer.MarketAnalyzerGrid. ApplyTemplate(String fileName)
    at NinjaTrader.Gui.MarketAnalyzer.MarketAnalyzerGrid. OnTemplateLoad(Object sender, RoutedEventArgs e)
    at System.Windows.EventRoute.InvokeHandlersImpl(Objec t source, RoutedEventArgs args, Boolean reRaised)
    at System.Windows.UIElement.RaiseEventImpl(Dependency Object sender, RoutedEventArgs args)
    at System.Windows.Controls.MenuItem.InvokeClickAfterR ender(Object arg)
    at System.Windows.Threading.ExceptionWrapper.Internal RealCall(Delegate callback, Object args, Int32 numArgs)
    at System.Windows.Threading.ExceptionWrapper.TryCatch When(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
    =======================



    thanks,
    Last edited by tecmisc1; 04-13-2020, 07:49 AM.

    #2
    Hello tecmisc1,

    Thank you for your post.

    If you create and save a new template for the Market Analyzer using the updated version of the indicator, save the workspace, and restart, do you get the same error? This could occur if you changed user inputs for the indicator from when it was previously used in the template.

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      The updated indicator does work correctly on the new template, so maybe it's an indicator MA column issue. However, I don't want to have to recreate the old MA template as it has many alerts and column formats.

      So my two questions In my original post still remain. Related to my question #2: I set my code for NT debugging, reloaded NT, and attached it to visual studio (set to break on all CLR and Managed exceptions), but it doesn't break on this exception. How can I make the debugger break on this exception to inspect it?

      Comment


        #4
        Hello tecmisc1,

        Thank you for your reply.

        If something fundamental in the indicator changed (like you added or removed a parameter, in particular) the template would not automatically adjust to the new version, no. You generally would need to create a new template. I understand that isn't what you'd prefer to do, but there's not a way to alter the template to match the new version of the indicator from within NinjaTrader if it's giving you an error. You wouldn't be able to catch the exception from my understanding because it's triggered by the template and not by the indicator itself.

        One thing we can try to avoid having you totally rebuild your template - if you provide the template (it should be saved under Documents > NinjaTrader 8 > templates > MarketAnalyzer), as well as the name of the indicator that was changed, I can see if I can go into the XML of the template itself, remove only that particular column, and then return it to you. You could then readd the column with the indicator in question and try resaving the template with a different name to test.

        If you attach the template file to your reply I'm happy to give that a try.

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          I found the problem. I had deleted an MA column in one of my indicators that this MA template was using. The template worked when I added that MA column back. Although I was able to figure this out by analyzing the workspace xml file in notepad++, it would be MUCH easier for the user if NT could catch any template exception and display the details (such as an MA column name) in the control center log. Would you please submit that idea as an NT feature request?

          Comment


            #6
            Hello tecmisc1,

            Thank you for your suggestion.

            I have create a feature request to log template exceptions in the log with information on what column caused the error. This request is being tracked under the number SFT-4725.

            As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

            Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by wzgy0920, 04-20-2024, 06:09 PM
            2 responses
            26 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, 02-22-2024, 01:11 AM
            5 responses
            32 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, Yesterday, 09:53 PM
            2 responses
            49 views
            0 likes
            Last Post wzgy0920  
            Started by Kensonprib, 04-28-2021, 10:11 AM
            5 responses
            192 views
            0 likes
            Last Post Hasadafa  
            Started by GussJ, 03-04-2020, 03:11 PM
            11 responses
            3,235 views
            0 likes
            Last Post xiinteractive  
            Working...
            X