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 CarlTrading, 03-31-2026, 09:41 PM
              1 response
              134 views
              1 like
              Last Post NinjaTrader_ChelseaB  
              Started by CarlTrading, 04-01-2026, 02:41 AM
              0 responses
              75 views
              1 like
              Last Post CarlTrading  
              Started by CaptainJack, 03-31-2026, 11:44 PM
              0 responses
              119 views
              2 likes
              Last Post CaptainJack  
              Started by CarlTrading, 03-30-2026, 11:51 AM
              0 responses
              114 views
              1 like
              Last Post CarlTrading  
              Started by CarlTrading, 03-30-2026, 11:48 AM
              0 responses
              92 views
              0 likes
              Last Post CarlTrading  
              Working...
              X