Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CS0426 error compiling strategy

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

    CS0426 error compiling strategy

    Hi,

    I'm getting the following CS0426 error when I compile my strategy:

    The type or namespace name indicator_name could not be found (are you missing a directive or an assembly reference?)

    I've replaced the actual indicator name with 'indicator_name' as I'm not sure how the vendor would feel about publishing the name publicly. I declare it as follows:

    namespace NinjaTrader.NinjaScript.Strategies
    {
    public class MyStrategy : Strategy
    {
    ....
    private indicator_name myIndicator;

    The vendor assembly is in the reference list already. This works without error when I host the vendor indicator in a custom indicator script as opposed to a strategy. Also hosting a wrapper indicator that hosts the vendor indicator internally works in the strategy. It's just hosting the vendor indicator directly that's failing.

    The vendor indicator is declared in the form VendorName.VendorIndicator.

    Thanks.

    #2
    Hello silverm3170,

    Thank you for your post.

    To clarify, indicator_name is in the form VendorName.VendorIndicator?

    Have you tried adding this indicator to a strategy by using it in a condition in the Strategy Builder? You could do this and unlock the code to see how it should be added.

    Thanks in advance; I look forward to assisting you further.

    Comment


      #3
      Hi Kate,

      Yes the indicator name is in the form VendorName.IndicatorName when declared, but the constructor is in the form IndicatorName only, e.g. myIndicator = IndicatorName(param list...) . I instantiate it during State == State.DataLoaded.

      I tried to use StrategyBuilder thinking the indicator could be added in the same manner as input params and plots. I didn't realize they could be added during the condition builder step. Let me give that a try. Thanks for the suggestion.

      Comment


        #4
        StrategyBuilder put it in the form Ninjatrader.Indicators.VendorName.IndicatorName. I made the change to my code and it worked. Thanks Kate!

        Comment


          #5
          Sorry, mean to say Ninjatrader.NinjaScript.Indicators.VendorName.Indi catorName

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, 03-13-2026, 05:17 AM
          0 responses
          95 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          153 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          80 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          54 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          67 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X