Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exceptions not handled in custom Optimizer

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

    Exceptions not handled in custom Optimizer

    When writing a custom optimizer, exceptions caused parts of the code to not execute with no obvious indication that an exception had occurred.

    This can be demonstrated by inserting the following code snippet into an Optimizer:
    if (State == State.Configure)
    {
    Print("This statement prints.");
    throw new Exception("This exception prevents the following statement from executing.");
    Print("This statement does not print.");
    }

    The first Print() statement reaches the Output window, but nothing else.

    If the above code is added to a Strategy, the behavior is different. The first Print() statement is followed by a line describing the exception: it includes the Strategy name, method within which the exception occured and the text of the exception. This is much better than the behavior in the Optimizer.

    I have two requests:

    Apply whatever was done to make the Strategy report exceptions to the Optimizer and any other user programmable components have the same problem as the Optimizer.

    Send a MessageBox so we don't have to constantly watch the Output window to determine whether an exception has occured.

    Thanks

    #2
    Hello,

    Thank you for the post.

    I do see that in beta 9 this is actually being logged, I am unsure if this was or was not previously.

    This type of runtime exception would generally not appear in the Output window but instead would be in the Log. I can confirm I see the exception being thrown in the Control Center log tab before you even can test a script, this occurs as soon as you select Optimization from the drop down.

    Can you confirm are you using B9 and also see this in the Log tab?

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

    Comment


      #3
      Yes, I do see the line about the exception in the log tab as well as the output window and I am using Build 9.

      However, there is often a considerable delay between the exception being thrown and the line appearing in either the output or log window. It seems there is a buffer that has to fill up before adding new lines to either window. That exacerbates the challenges in debugging; hence my request for a MessageBox.

      Thanks for looking into this.

      Comment


        #4
        Hello,

        I will submit this as a feature request as well.

        Please let me know if I may be of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, 04-17-2024, 06:40 PM
        6 responses
        48 views
        0 likes
        Last Post algospoke  
        Started by arvidvanstaey, Today, 02:19 PM
        4 responses
        11 views
        0 likes
        Last Post arvidvanstaey  
        Started by samish18, 04-17-2024, 08:57 AM
        16 responses
        61 views
        0 likes
        Last Post samish18  
        Started by jordanq2, Today, 03:10 PM
        2 responses
        9 views
        0 likes
        Last Post jordanq2  
        Started by traderqz, Today, 12:06 AM
        10 responses
        18 views
        0 likes
        Last Post traderqz  
        Working...
        X