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 Perr0Grande, Today, 08:16 PM
          0 responses
          2 views
          0 likes
          Last Post Perr0Grande  
          Started by elderan, Today, 08:03 PM
          0 responses
          3 views
          0 likes
          Last Post elderan
          by elderan
           
          Started by algospoke, Today, 06:40 PM
          0 responses
          10 views
          0 likes
          Last Post algospoke  
          Started by maybeimnotrader, Today, 05:46 PM
          0 responses
          9 views
          0 likes
          Last Post maybeimnotrader  
          Started by quantismo, Today, 05:13 PM
          0 responses
          7 views
          0 likes
          Last Post quantismo  
          Working...
          X