Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Missing custom "using" declaration

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

    Missing custom "using" declaration

    Hello!
    When I create the indicator, I also create the custom namespace in the same file
    Code:
    using ......
    using myNameSpace;
    
    namespace NinjaTrader.NinjaScript.Indicators
    {
          public class MyIndicator: Indicator
          {
           .....
    
                 [NinjaScriptProperty]
                public myCustomType PropertyName
                 {
                      get;
                       set;
                  }
           }
    }
    
    namespace myNameSpace
    {
    
        public myCustomType
        {
             ......
         }
    }
    when I export my indicator as compiled assembly I can't find my using declaration in *.cs file within the *.zip file. So, when I try to import my indicator on other computer I get an error: "Can't find type myCustomType. Are you missing the custom assembly reference?".
    When I type in this using declaration manualy, ninja successfuly imports the indicator and everything works fine.

    #2
    Hello,

    Thank you for the question.

    In general with compiled assemblies, if you are using another namespace it would be best to use the fully qualified type name rather than a using statement to ensure everything links up.

    for example rather than using the using statement, have you tried:

    myNameSpace.myCustomType

    This would likely resolve the problem, this mainly happens when using enums in a custom namespace and not using the fully qualified name.

    If that does not correct the problem, could you attach a simplified example that demonstrates this that we could work with?

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by serialbug View Post
      Hello!
      When I create the indicator, I also create the custom namespace in the same file
      Code:
      using ......
      using myNameSpace;
      
      namespace NinjaTrader.NinjaScript.Indicators
      {
            public class MyIndicator: Indicator
            {
             .....
      
                   [NinjaScriptProperty]
                  public myCustomType PropertyName
                   {
                        get;
                         set;
                    }
             }
      }
      
      namespace myNameSpace
      {
      
          public myCustomType
          {
               ......
           }
      }
      when I export my indicator as compiled assembly I can't find my using declaration in *.cs file within the *.zip file. So, when I try to import my indicator on other computer I get an error: "Can't find type myCustomType. Are you missing the custom assembly reference?".
      When I type in this using declaration manualy, ninja successfuly imports the indicator and everything works fine.
      ref: http://ninjatrader.com/support/forum...74&postcount=9

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by WHICKED, Today, 12:56 PM
      0 responses
      0 views
      0 likes
      Last Post WHICKED
      by WHICKED
       
      Started by Spiderbird, Today, 12:15 PM
      2 responses
      10 views
      0 likes
      Last Post Spiderbird  
      Started by WHICKED, Today, 12:45 PM
      0 responses
      6 views
      0 likes
      Last Post WHICKED
      by WHICKED
       
      Started by FrazMann, Today, 11:21 AM
      2 responses
      6 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by rjbtrade1, 11-30-2023, 04:38 PM
      2 responses
      80 views
      0 likes
      Last Post DavidHP
      by DavidHP
       
      Working...
      X