Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stack Trace by Default for Debug Mode

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

    Stack Trace by Default for Debug Mode

    Only when the custom assembly is compiled in "debug mode" (right-click in script editor), and an exception occurs, in addition to putting the Exception message into the Log tab of Control Center (which is what currently happens), it should output a stack trace (which because we're in debug mode has line numbers available) to the Log tab and/or to the Output window.

    Additionally, there should be a setting somewhere such as in Tools -> Options for the maximum number of exceptions to log, such as one per run of an indicator/strategy/ninjascript, and another checkbox for whether to allow it to continue running or terminate it if the number is exceeded. These would default to the current behavior.

    Yes, we can add the code to do this ourselves (and I often do if I'm tracking something down) but then again, why shouldn't "debug mode" do this for us? It's such a common need - and I can't count the number of times I've read a post in which support directs a beginning programmer to fill up their code with print statements to track down where something is failing - if they had this easy-to-add request, it would be quite clear - compile it in debug mode, and the Log tab will tell you the exact line number that threw the exception.

    This is not only helpful to trader-developers in that it saves them time but it would also lighten the load on support. I'll bet they would use it as well so they don't have to keep doing what I do (adding the try-catch output re-throw etc. every time there is an issue or in anticipation of one). There are some threads like https://forum.ninjatrader.com/forum/...rmation-in-log in which this type of busywork is discussed - but it is the suggestion here that the platform should have this built-in, in the interest of doing the right thing and saving support and everyone using the platform time by pointing out exactly what the problem is.

    Let's face it - if they're in "debug" mode, they already know they have a problem which many times is in the form of an unwanted exception - so knowing this, you should immediately give them the information they need to pinpoint it. You're already catching the exception because you're printing the message to Control Center. Just give them the full stack trace, and a way to limit how many of these it does, and they'll have what they need to make rapid progress.
    Last edited by QuantKey_Bruce; 03-18-2023, 06:11 PM.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    #2
    Additionally, if the exception occurs in OnStateChange it should indicate what State is equal to, and if the exception occurs in OnBarUpdate or OnMarketData it should indicate if it does not already not just the bar number but if there is more than one bar series loaded, also what BarsInProgress is and if it does not already what the symbol and timeframe are. These are perhaps the most commonly needed elements, so putting them in there for Debug mode only does not hurt anything and will probably help significantly save time for others. I'm already almost always doing these things on my own - but I think they should be inbuilt because it would help others by preemptively providing what they are most commonly going to want to know.
    Last edited by QuantKey_Bruce; 03-18-2023, 07:00 PM.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      QuantKey_Bruce Are you checking the trace file? Most "unhandled exceptions" have a full stack trace in that file.

      Thanks.
      Multi-Dimensional Managed Trading
      jeronymite
      NinjaTrader Ecosystem Vendor - Mizpah Software

      Comment


        #4
        Originally posted by jeronymite View Post
        QuantKey_Bruce Are you checking the trace file? Most "unhandled exceptions" have a full stack trace in that file.
        But is that the intended development workflow for NinjaTrader users to go through the log and trace files? The exception message is output to the Log tab and to the Output Window precisely because they're convenient and accessible during use of the program. I'm saying here that when you're in debug mode, you're debugging, so you'll want to see the line number where the exception happened. Instructing users to go digging through the files in a directory is not the most helpful thing when the information is right there.
        Bruce DeVault
        QuantKey Trading Vendor Services
        NinjaTrader Ecosystem Vendor - QuantKey

        Comment


          #5
          QuantKey_Bruce I agree. The information is available. Your recommendation that it be made more easily available is good. Nevertheless, if one is programming, the extra inconvenience of opening the current trace file and going to its end to discover the detail of an error is still relatively straightforward. Not ideal, but not odiously difficult either. But your recommended enhancement is also not a difficult ask and worthy of implementation.

          Thanks.
          Multi-Dimensional Managed Trading
          jeronymite
          NinjaTrader Ecosystem Vendor - Mizpah Software

          Comment


            #6
            Hello Bruch, thanks for writing in. I will submit a feature request for your suggestion on stack traces. I will post the tracking ID here when I recieve it.
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by frslvr, 04-11-2024, 07:26 AM
            9 responses
            123 views
            1 like
            Last Post caryc123  
            Started by rocketman7, Today, 09:41 AM
            4 responses
            15 views
            0 likes
            Last Post rocketman7  
            Started by selu72, Today, 02:01 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by WHICKED, Today, 02:02 PM
            2 responses
            16 views
            0 likes
            Last Post WHICKED
            by WHICKED
             
            Started by f.saeidi, Today, 12:14 PM
            8 responses
            21 views
            0 likes
            Last Post f.saeidi  
            Working...
            X