Announcement

Collapse
No announcement yet.

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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    47 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    15 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    21 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X