Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Error Line Code Number

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

    Error Line Code Number

    Hello

    On my strategy when an error is thrown I catch it and print it using Exception.ToString().
    When it happans the method gives me the number of the code line in which the error was thrown. For example:

    at NinjaTrader.Strategy.MyStrategy.MyFunction() in c:\Users\MyUser\Documents\NinjaTrader 7\bin\Custom\Strategy\MyStrategy.cs:line 8624

    However, I've installed my strategy on a new computer and on my new computer I cannot see the line number anymore (the "Debug Mode" value on the code editor is checked.

    How can I see the line number on my new computer as well?

    Thanks

    #2
    Hello,

    Thank you for the question.

    I wanted to check, have you tried creating a sample script for testing and just thrown an Exception to ensure that is working?

    I tried the following:

    Code:
    try
    {
    	throw new Exception("Test Exception", new Exception());
    } catch(Exception e)
    {
    	Print(e.ToString());	
    }


    which produced

    System.Exception: Test Exception ---> System.Exception: Exception of type 'System.Exception' was thrown.
    --- End of inner exception stack trace ---
    at NinjaTrader.Indicator.TEst.OnBarUpdate() in TEst.cs:line 44
    It does look like this is toggled with Debug mode, Have you also tried Unchecking Debug mode, Compile, Check debug mode, Compile and then re run the test?

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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by GussJ, 03-04-2020, 03:11 PM
    11 responses
    3,221 views
    0 likes
    Last Post xiinteractive  
    Started by andrewtrades, Today, 04:57 PM
    1 response
    10 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
    9 views
    0 likes
    Last Post FAQtrader  
    Working...
    X