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

Determining the source code line number

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

    Determining the source code line number

    Is this possible programmatically?

    #2
    Unfortunately this is not supported jp_kettunen.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      jp_kettunen, the only way I know to get this to work is by enabling debug mode (right click in the ninjascript editor and click "Debug Mode"). Once that's done, try this:

      Code:
      StackTrace trace = new StackTrace(new StackFrame(true));
      StackFrame frame = trace.GetFrame(0);
      Print(String.Format("File: {0} Line# {1}", frame.GetFileName(),frame.GetFileLineNumber()));
      This will produce something like

      File: c:\Users\Dexter\Documents\NinjaTrader 7\bin\Custom\Indicator\myIndicator.cs Line# 47

      It will contain values based on the line the StackTrace instance is created. If you don't have debugging on it will only return blank / values of 0. Hope that helps

      Comment


        #4
        Thanks, might try.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by nightstalker, 05-04-2024, 02:05 PM
        5 responses
        52 views
        1 like
        Last Post nightstalker  
        Started by MSerag, Yesterday, 11:52 PM
        0 responses
        5 views
        0 likes
        Last Post MSerag
        by MSerag
         
        Started by DynamicTest, Yesterday, 11:18 PM
        0 responses
        3 views
        0 likes
        Last Post DynamicTest  
        Started by dcriador, Yesterday, 01:43 AM
        3 responses
        20 views
        0 likes
        Last Post dcriador  
        Started by smartromain, Yesterday, 10:50 PM
        0 responses
        5 views
        0 likes
        Last Post smartromain  
        Working...
        X