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 zstheorist, Today, 07:52 PM
          0 responses
          3 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          149 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          5 views
          0 likes
          Last Post mattbsea  
          Started by RideMe, 04-07-2024, 04:54 PM
          6 responses
          33 views
          0 likes
          Last Post RideMe
          by RideMe
           
          Started by tkaboris, Today, 05:13 PM
          0 responses
          5 views
          0 likes
          Last Post tkaboris  
          Working...
          X