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

Error compiling, in @Strategy.cs

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

    Error compiling, in @Strategy.cs

    When compiling an indicator, with some methods in the strategy folder, I can eliminate all errors, but still have one error that is perplexing. The error is NinjaTrader.Indicator' is a 'namespace' but is used like a 'type' (CS0118) in @Strategy.cs at line 23, column 12.

    Advice most appreciated.

    Thanks.
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    #2
    Error compiling, in @Strategy.cs

    Some additional information.

    I use a common code base for NT7 and NT8.

    At the start of my indicator, I set an appropriate Compiler Directive as follows:

    Code:
    #undef	NT7				// NinjaTrader 7 Code ONLY
    #define	NT8				// NinjaTrader 8 Code ONLY
    Then, at the start of the indicator proper I do this:

    Code:
    #if NT7
    namespace NinjaTrader.Indicator
    #endif
    #if NT8
    namespace NinjaTrader.NinjaScript.Indicators
    #endif
    Similarly, for both variations of the Strategies namespace for NT7 vs NT8.

    Now, a certain basic logic says this should be fine, and indeed if I remove all but the relevant NT8 namespace line, it still fails to compile, with the same error. So, I must presume this type of construct is not the issue.

    Thanks.
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    Comment


      #3
      Hello jeronymite,

      Thank you for your note.

      So I may best answer your question, what is it you are looking to achieve? Have code for both NT7 and NT8 within one .cs file?

      I look forward to your reply.
      Alan P.NinjaTrader Customer Service

      Comment


        #4
        Error compiling, in @Strategy.cs

        Thanks Alan.

        Yes, I have code that is very largely the same in both versions of NT. So, I have compiler directives in the relevant places for the version-specific code.

        On NT7, the compilation works perfectly. On NT8, this is the problem.

        Thanks.
        Multi-Dimensional Managed Trading
        jeronymite
        NinjaTrader Ecosystem Vendor - Mizpah Software

        Comment


          #5
          Hello jeronymite,

          Thank you for your response.

          Can you send the file attached to a note to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H' in the subject line and a reference to this thread in the body of the email?

          You can export your indicator by going to Tools > Export > NinjaScript Add On > Add > select your indicator > OK > Export > name the file 'NTsupport' > Save.

          The file will be located under Documents\NinjaTrader 8\bin\Custom\ExportNinjaScript. Please attach the file to your response.

          I look forward to assisting you further.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          27 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 04-23-2024, 09:53 PM
          2 responses
          49 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          193 views
          0 likes
          Last Post Hasadafa  
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,235 views
          0 likes
          Last Post xiinteractive  
          Working...
          X