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 Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              605 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              351 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              105 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              560 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              561 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X