Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT compiler does not detect for compiler directive

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

    NT compiler does not detect for compiler directive

    The NT compiler will report "NinjaTrader.indicator.xx does not contain a definition for 'myVar' ..." when compiling the following code with compiler directive. It seem that it does not pre-process the compiler directive before generating the "NinjaScript generated code".

    //#define TESTING

    #if TESTING
    // defined in the variable section of the class
    private int myVar;
    #endif

    #if TESTING
    // in the Properties region
    [GridCategory("Debugging")]
    public int MyVar
    {
    get { return myVar; }
    set { myVar = value; }
    }
    #endif

    Hope that it will be addressed in the next revision of NT.

    #2
    Hello,

    Thank you for reporting. I will have someone respond to you in the morning.
    MatthewNinjaTrader Product Management

    Comment


      #3
      ckkoh_sgp, it seems to work for me in quick test run, did you define TESTING before any regular C# code / classes etc?

      Comment


        #4
        Hi Bertrand,

        Thanks for your speedy response. The problem happens when I undefine the compiler directive ie. by commenting out the TESTING. It is not a problem when the directive is defined.

        Comment


          #5
          You're welcome, I guess I'm not following you here - why would expect this to compile with the TESTING define commented out? This would be an elementary part, or not?

          Thanks,

          Comment


            #6
            I use the compiler directive for the convenience of enabling some segment of the code and exposing some additional debugging parameters during debugging of the indicator. So, when I no longer need to debug, I could just comment out the compiler directive to "remove" the particular segment of code and hide the debugging parameters.

            Comment


              #7
              Works for me like that as well, if the #define TESTING is declared really at the top of the code so before the USING Declarations section, if I comment that out - the debug input is not seen, if not > it appears as expected.

              Comment

              Latest Posts

              Collapse

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