Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Failed strategy compilation

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

    Failed strategy compilation

    I am using custom PriceActionSwingOscillator indicator (enclosed) to create a strategy using Strategy Builder.
    I am getting failed to compile messages. When unlocking code I see the message that this indicator is method.
    Is there any way to overcome that ?
    Strategy is quite simple: GO LONG when RTUptrend equal 1. And EXIT when RTDowntrend equal 1 ( see attachments)
    Thanks
    Attached Files

    #2
    Hello kazbek966,

    Thank you for your post.

    I have moved this from the Technical Support section of the forum to the Strategy Development section. So I may accurately assist you, please answer all of the following questions:
    • What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)
    • Is the PriceActionSwingOscillator an indicator that you developed or one that was imported from a third party?
    What compile error(s) are you getting?
    • Go to the Control Center > New > NinjaScript Editor
    • Right-click in the NinjaScript Editor > select 'Compile'
    You should see some errors in orange appear at the bottom of the window. Expand this window so that as many of these error messages, if not all of them, are visible. Please send us a screenshot of these errors, and we will be able to send you the steps to resolve them.

    A visual walkthrough of this process along with solutions to common compile errors may be found here in our Help Center.

    To send a screenshot with Windows 10 or newer I would recommend using the Windows Snipping Tool - Click here for detailed instructions

    I look forward to your reply.

    Comment


      #3
      Hi Emily,
      1. 8.0.28.0 64-bit
      2. As seen from enclosed cs file it is third party indicator which I happen to use quite often, and it never been an issue before
      3. Error code is CS0119 on a line 69, columns 72 and 127 I believe ,there is fair long message with Indicator parameters ending with "is a method) which is not

      else if (State == State.DataLoaded)
      {
      StrategyTotallPNL = new Series<double>(this);
      CurrentPNL = new Series<double>(this);
      PriceActionSwingOscillator1 = PriceActionSwingOscillator(Close, PriceActionSwing.Base.SwingStyle.Standard, 3, 8, true, PriceActionSwing.Base.Show.Trend, true, false, false);
      HalfTrend1 = HalfTrend(Close, Convert.ToInt32(PARAM), PARAM, 100, true, true, 10);
      Momentum1 = Momentum(HalfTrend1.DnSignal, 1);
      }​

      I am enclosing txt file with the strategy. Please do not pay much attention to the presence of custom third party half-Trend Indicator as by itself it works just fine.

      Attached Files

      Comment


        #4
        Hello kazbek966,

        Thank you for your reply.

        Since you are getting a CS 0119 error, please reach out to the developer of the indicator (their email address seems to appear in a comment at the beginning of the script). In some other forum threads, users have gotten CS 0119 errors when trying to use a particular indicator in their strategy, and the resolution was to add a specific using statement to the top of the strategy script. The developer of the indicator should be able to confirm with you if a using statement is needed, and if so what using statement you should use.

        As a side note, adding a using statement would require you to work with the strategy unlocked in the NinjaScript Editor because it is not possible to add a using statement in the Strategy Builder. Ultimately, this particular indicator does not seem to be compatible with the Strategy Builder and any questions about its use in other scripts should be directed to the developer directly.

        Thank you for your time and patience.

        Comment


          #5
          Thank you, Emily.
          So what are usual " using statements " are ?

          Comment


            #6
            Hello kazbek966,

            Thank you for your reply.

            Using statements are a general C# concept and are not specific to NinjaTrader. You may find out more about them by searching through third-party C# resources, such as the following publicly available link:
            The `using` directive imports types from a namespace, or creates an alias for a given type. Using directives enable you to use simple names for types instead of the fully qualified type name.

            When creating a strategy via the Strategy Builder, the minimum code to work with any supported NinjaScript type is added, including the using statements at the top of the script. Since you are having issues when trying to add a custom indicator to your strategy, you will need to reach out to the developer of the indicator for assistance on how to do so since it does not seem to work with the default using statements that are added. An additional using statement may be needed or you may need to use the fully qualified namespace; either way, something with their indicator is causing the errors so they will need to address it.

            Please let us know if we may be of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            88 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            48 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            31 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            34 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            68 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X