Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 Error, Unhandled exception: Index was out of range

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

    NT8 Error, Unhandled exception: Index was out of range

    Hello,

    When launching Ninjatrader 8 this morning, I got an error message saying:

    Unhandled exception: Index was out of range

    Then the program crashed. After that I launched NT8 and it worked fine.

    Is there anything I need to do about that error and crash?

    Screenshot attached,

    P.S. I really like Ninjatrader 8, you folks did a really great job with it
    Attached Files

    #2
    NT8 Error, Unhandled exception: Index was out of range

    Hello i2w8am9ii2,

    Thanks for writing in to our Support team, and we're glad that you are enjoying using NinjaTrader 8.

    Please send me your log and trace files so that I may look into what occurred.

    You can do this by going to the Control Center-> Help-> Mail to Platform Support.

    Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

    Please put ATTN Alan S in the subject line and reference this forum post in the body of your email: http://www.ninjatrader.com/support/f...ad.php?t=96747

    I look forward to your reply.
    Alan S.NinjaTrader Customer Service

    Comment


      #3
      I thought I had fixed this issue, but it seems to still happen when an email alert gets tripped when there is more than 1 email alert (triggered within Market Analyzer alert, column equals numeric value).

      One thing to note, if there are 3 alerts triggered, then there is always 1 less error... so 3 alerts gives 2 exceptions... 5 alerts gives 4 exceptions... as if the first one works, then subsequent ones throw an error (but the email is actually sent every time, even though there is an exception).


      From the LOG file

      PHP Code:
      2017-04-05 09:37:53:983|0|4|Unhandled exceptionIndex must be within the bounds of the List. Parameter nameindex 

      From the TRACE file

      PHP Code:
      2017-04-05 09:35:47:079 (KinetickCbi.Connection.Connect9 ok
      2017
      -04-05 09:35:47:320 Cbi.Instrument.RequestBars (to Provider): instrument='NQ 06-17' from='4/5/2017 12:00:00 AM' to='4/5/2017 12:00:00 AM' period='1 Minute'
      2017-04-05 09:37:53:982 *************** unhandled exception trapped ***************
      2017-04-05 09:37:53:982 Index must be within the bounds of the List.
      Parameter nameindex
      2017
      -04-05 09:37:53:983 System.ArgumentOutOfRangeExceptionIndex must be within the bounds of the List.
      Parameter nameindex
         at System
      .ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argumentExceptionResource resource)
         
      at System.Collections.ObjectModel.Collection`1.Insert(Int32 index, T item)
         at NinjaTrader.Gui.Alerts.AlertListener.<>c__DisplayClass11_2.<<WorkerThread>b__1>d.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
         at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
         at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 

      Unfortunately, that doesn't seem to point to much. There was a discussion about "static" items being problematic, so I completely removed all static functions, classes, and variables from this indicator, but that didn't seem to make a difference.

      I'm not sure what to even look for or how to debug. Any help is greatly appreciated!
      Last edited by neoikon; 04-05-2017, 09:26 AM.

      Comment


        #4
        Hello neoikon,

        Your NinjaScript / C# Code will always be logically processed and evaluate according to your set logic – this can of course lead to unexpected results at times, thus we would suggest to simplify and debug your code to better understand the event sequence it would go through - unfortunately we cannot offer such debug or code modification services here, but please see the provided resources below to help you proceed productively :

        First of all you would want to use Print() statements to verify values are what you expect - Debugging your NinjaScript Code - Debugging your NinjaScript code.

        For strategies add TraceOrders = true to your Initialize() method and you can then view valuable output related to strategy submitted orders through Tools > Output window - Trace Orders

        It may also help to add drawing objects to your chart for signal and condition confirmation - Drawing Objects

        Please let me know if I may be of any further assistance.
        Alan S.NinjaTrader Customer Service

        Comment


          #5
          Thank you for the reply. Unfortunately, I can reproduce this with the built-in indicators as well (so I don't think it's an issue with my indicator).

          Steps to reproduce:
          1. Create a new Market Analyzer window, include 2 columns: Instrument and RSI (NT's builtin indicator)
          2. Add multiple instruments/rows (not just 1)
          3. Right-click, to go Alerts.
          4. Set the Condition that RSI is >= 0 (so it will be true for all rows)
          5. Set the Action to "Share an email" (requires setting up the Share service)
          6. Leave all other alert settings as default.
          7. Hit OK and it should start triggering alerts, sending emails, and firing exceptions


          Did this cause the exceptions for you?

          Comment


            #6
            Hello neoikon,

            Thanks for your reply and for providing me with that information, it was very helpful for me to be able to reproduce this issue. I am reporting this to our development team and we will be taking a look into this behavior to see why it is occurring.

            Please let me know if I may be of any further assistance.
            Alan S.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_AlanS View Post
              Hello neoikon,

              Thanks for your reply and for providing me with that information, it was very helpful for me to be able to reproduce this issue. I am reporting this to our development team and we will be taking a look into this behavior to see why it is occurring.

              Please let me know if I may be of any further assistance.
              Hello,
              has there been a fix for this issue? I have just started to get the "index out of range" error.

              Thank you.

              Edit: I have not tested this for long enough to be sure yet, but it seemed to start when I changed one of the colours in a Multi-coloured plot to Brown. I have changed it to another colour, and the behaviour has not returned so far.
              Last edited by GeorgeW; 05-18-2017, 04:09 AM.

              Comment


                #8
                Hello GeorgeW,

                Thanks for writing in to our Support team.

                Please send me your log and trace files so that I may look into what occurred.

                You can do this by going to the Control Center-> Help-> Mail to Platform Support.

                Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

                Please put ATTN Alan S in the subject line and include a link to this forum post in the body of the email.

                I look forward to your reply.
                Alan S.NinjaTrader Customer Service

                Comment


                  #9
                  The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method. Indexing an empty list will always throw an exception. Use a method like Add to append the item to the end of the list, or Insert to place the item in the middle of the list somewhere, etc. You cannot index into a list if that offset doesn't exist.

                  Typically, an ArgumentOutOfRangeException results from developer error. Instead of handling the exception in a try/catch block, you should eliminate the cause of the exception or, if the argument is returned by a method call or input by the user before being passed to the method that throws the exception, you should validate arguments before passing them to the method.

                  List class is a collection and defined in the System.Collections.Generic namespace and it provides the methods and properties like other Collection classes such as add, insert, remove, search etc.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Kaledus, Today, 01:29 PM
                  1 response
                  7 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by frankthearm, Yesterday, 09:08 AM
                  13 responses
                  45 views
                  0 likes
                  Last Post frankthearm  
                  Started by PaulMohn, Today, 12:36 PM
                  2 responses
                  16 views
                  0 likes
                  Last Post PaulMohn  
                  Started by Conceptzx, 10-11-2022, 06:38 AM
                  2 responses
                  55 views
                  0 likes
                  Last Post PhillT
                  by PhillT
                   
                  Started by yertle, Yesterday, 08:38 AM
                  8 responses
                  37 views
                  0 likes
                  Last Post ryjoga
                  by ryjoga
                   
                  Working...
                  X