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 when exporting indicator

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

    Error when exporting indicator

    I'm trying to export an indicator of mine and I got this error message:

    6/20/2013 5:51:45 PM Default Error compiling export assembly: c:\Users\xxx\Start Menu\documents\NinjaTrader 7\bin\Custom\Indicator\MyIndicator.cs(626,106) : error CS0246: The type or namespace name 'MAType' could not be found (are you missing a using directive or an assembly reference?)

    I first thought it was one of my references but then realized that MAType is an internal NT type. So what's going on there?

    Thanks,

    Molecool

    #2
    Originally posted by molecool View Post
    I'm trying to export an indicator of mine and I got this error message:

    6/20/2013 5:51:45 PM Default Error compiling export assembly: c:\Users\xxx\Start Menu\documents\NinjaTrader 7\bin\Custom\Indicator\MyIndicator.cs(626,106) : error CS0246: The type or namespace name 'MAType' could not be found (are you missing a using directive or an assembly reference?)

    I first thought it was one of my references but then realized that MAType is an internal NT type. So what's going on there?

    Thanks,

    Molecool
    Nope. MAType is not an internal NT type.

    You have an indicator that is using MAType, and is missing the namespace in which it is defined. Find out which indicator it is, and correct it, by defining the enum, either within a custom namespace in the file, or else by doing what you should NEVER do, and defining the enum as a pollutant in the global namespace. I know that that is what NT says to do.

    However, it is Programming-101 to never pollute the global namespace. I would surmise that the original code author did define MAType in the global namespace, and as you do not have his/her global namespace, you are missing the definition. That is precisely one of the reasons why one should never pollute the global namespace.

    Comment


      #3
      Originally posted by koganam View Post
      Nope. MAType is not an internal NT type.

      You have an indicator that is using MAType, and is missing the namespace in which it is defined. Find out which indicator it is, and correct it, by defining the enum, either within a custom namespace in the file, or else by doing what you should NEVER do, and defining the enum as a pollutant in the global namespace. I know that that is what NT says to do.

      However, it is Programming-101 to never pollute the global namespace. I would surmise that the original code author did define MAType in the global namespace, and as you do not have his/her global namespace, you are missing the definition. That is precisely one of the reasons why one should never pollute the global namespace.
      Yeah, you were right and I identified the offending code. Problem is WHERE to stick it - I think the only alternative I can think of is to create a custom DLL and bind that into NinjaTrader. That's the only way to ensure reuse without making a mess of it all.

      Comment


        #4
        Originally posted by molecool View Post
        Yeah, you were right and I identified the offending code. Problem is WHERE to stick it - I think the only alternative I can think of is to create a custom DLL and bind that into NinjaTrader. That's the only way to ensure reuse without making a mess of it all.
        If you want to follow "best practice", you declare the namespace in the class file, and use it directly. A few years ago, we had some pretty long dicussions about this. Here is one of the answers that I gave: http://www.ninjatrader.com/support/f...d.php?p=216047

        You may want to read the whole thread: http://www.ninjatrader.com/support/f...d.php?p=215996

        If you want more of the gory details, you can do a search on the keywords: pollute global namespace. That should be illuminating.

        Comment


          #5
          Originally posted by koganam View Post
          If you want to follow "best practice", you declare the namespace in the class file, and use it directly. A few years ago, we had some pretty long dicussions about this. Here is one of the answers that I gave: http://www.ninjatrader.com/support/f...d.php?p=216047

          You may want to read the whole thread: http://www.ninjatrader.com/support/f...d.php?p=215996

          If you want more of the gory details, you can do a search on the keywords: pollute global namespace. That should be illuminating.
          I used to be a systems architect back in the days so trust me - I am intimately familiar with the issue ;-)

          When I started with Ninja about four years ago I came from coding mostly in Java and had little exposure to C# and namespaces. Something like this I would have simply put in an abstract class. As a purist the concept of namespaces freaks me out a little but putting it into a separate DLL appears to be a decent practice.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Jonker, Today, 01:19 PM
          0 responses
          1 view
          0 likes
          Last Post Jonker
          by Jonker
           
          Started by futtrader, Today, 01:16 PM
          0 responses
          5 views
          0 likes
          Last Post futtrader  
          Started by Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,790 views
          0 likes
          Last Post aligator  
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          838 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,294 views
          1 like
          Last Post jgualdronc  
          Working...
          X