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

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?
      BertrandNinjaTrader Customer Service

      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,
          BertrandNinjaTrader Customer Service

          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.
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by judysamnt7, 03-13-2023, 09:11 AM
              4 responses
              59 views
              0 likes
              Last Post DynamicTest  
              Started by ScottWalsh, Today, 06:52 PM
              4 responses
              36 views
              0 likes
              Last Post ScottWalsh  
              Started by olisav57, Today, 07:39 PM
              0 responses
              7 views
              0 likes
              Last Post olisav57  
              Started by trilliantrader, Today, 03:01 PM
              2 responses
              21 views
              0 likes
              Last Post helpwanted  
              Started by cre8able, Today, 07:24 PM
              0 responses
              10 views
              0 likes
              Last Post cre8able  
              Working...
              X