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

dll error in installation

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

    dll error in installation

    I worked on some ninjascript and the script works well as an open source but if I compile it into a dll it has and issue stating dll exists. I went online and thought it was the custom enum values created. I encapuslated the enumeration values and I still have this issue.


    I noticed the code uses DeviationType as a parameter for a Points and Percent


    Will Deviation type create this error ?


    If so do I create a custome enum for deviation type and then initialize deviation type.

    #2
    Hello ballboy11,

    There are some considerations when exporting an assembly.


    First, are you exporting the assembly and then importing this into a clean environment that does not have the original script?

    Are the enums in a custom namespace but within the file that is being exported?

    What is the error message you are getting?

    Is your script calling drawing objects?
    Are you attempting to loop through drawing objects?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      First, are you exporting the assembly and then importing this into a clean environment that does not have the original script?

      No the user has an old version and is trying to install the new dll

      Are the enums in a custom namespace but within the file that is being exported?
      Yes except the Deviation Type which is within the zigzag indicator

      What is the error message you are getting?
      I will have to get the tracelog from the user

      Is your script calling drawing objects?
      yes

      Are you attempting to loop through drawing objects?
      yes

      This is a zigzag emum when i parsed to find what Deviation Type was.


      Time Category Message
      error CS0246: The type or namespace name 'DeviationType' could not be found (are you missing a using directive or an assembly reference?)

      If I do compile open source it has no errors if I add zigzag.

      I can compile a dll but the user can not install it.
      Last edited by ballboy11; 07-16-2017, 07:27 PM.

      Comment


        #4
        Hello ballboy11,

        Are you using the dynamic type when looping through drawing objects as directed in the guide I have linked you?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          no they are not dymanic. I use a for loop and my tags have names with a count ID.
          I uploaded the error as a png. I was wondering if it is DeviatonType from the ZigZag indicator.
          Attached Files

          Comment


            #6
            enumerations and dll

            Is there a proper procedure creating custom enumeratons. I know it is the enumeration that is causing this problem. I made a new blank indicator and copied the code and when compiling the the emun errors appeared.

            First I had it global before the namespace and I got the error in the old indicator
            Second I created a seperate namespace and still it didn't work.



            public enum eIndicatorType
            {
            SWING,
            ZIGZAG
            }




            public enum eLineLength
            {
            INFINITE,
            UNTIL_NEXT_SIGNAL,
            NUMBER_OF_BARS,
            }

            Comment


              #7
              Hello ballboy11,

              If the script is not importing, likely because of duplicate classnames or enum names, you would need to remove the existing script using those names.

              Are you able to import the script into a clean environment?

              Wrapping the enum in custom namespace also means any calls to that enum must be through that namespace as well.

              For example:

              Code:
              namespace MyCustomIndicatorEnums
              {
              public enum eLineLength
              {
              INFINITE,
              UNTIL_NEXT_SIGNAL,
              NUMBER_OF_BARS,
              }
              }
              Then in the indicator or strategy you may have a public property such as

              Code:
              [NinjaScriptProperty]
              [Display(Name = "e Line Length", Order = 0, GroupName = "Parameters", Description = "The length of the eline")]
              public MyCustomIndicatorEnums.eLineLength ELineLength
              { get; set; }
              If you do not use the dynamic type when looping through drawing objects, after exporting the assembly this will can a runtime error in the script. This is detailed in the documented I have linked you.

              From the help guide:
              "An obstacle arises with traditional typecasting in a compiled assembly, since the NinjaScript Type you attempt to cast will be present in both your DLL and NinjaTrader's Custom.dll assembly."

              (edit)
              Also, you previously mentioned you are using a DeviationType enum, however, you have posted a different enum.
              Are you trying to wrap the DeviationType enum into a namespace?
              Are you no longer getting an error with this?
              What code are you using when creating the public input.
              Last edited by NinjaTrader_ChelseaB; 07-19-2017, 09:31 AM.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hello.

                I have the same problem with custom enum inside indicator: cs script compiled ok, but importing dll in the clean system causing the error.

                Enum definition:
                Code:
                namespace NinjaTrader.NinjaScript.Indicators.My_Indcator_Folder
                {
                    public class My_Indicator : Indicator  
                    {
                        public enum MyEnum_enum
                        {
                             One,  
                             Two,
                             Free    
                        }
                   }
                }
                Enum usage everywhere in code:
                Code:
                NinjaTrader.NinjaScript.Indicators.My_Indcator_Folder.My_Indicator.MyEnum_enum My_Var;
                My_Var = NinjaTrader.NinjaScript.Indicators.My_Indcator_Folder.My_Indicator.MyEnum_enum.One;
                Public property:
                Code:
                        [NinjaScriptProperty]
                        [Display(GroupName="GroupName",    Name="MyEnum"        Order=1)] 
                        public NinjaTrader.NinjaScript.Indicators.My_Indcator_Folder.My_Indicator.MyEnum_enum MyProperty        { get; set; }
                Error while dllimport:
                Error compiling import assembly: c:\Users\username\Documents\NinjaTrader 8\bin\Custom\My_Indicator.cs(36,75 ) : error CS0246: The type or namespace name 'MyEnum_enum' could not be found (are you missing a using directive or an assembly reference?)

                And I have this error for each row where enum used.
                And this has happened on my PC.

                On another PC, where indicator was never installed before, have another error message appears when importing the same dll:
                Import failed, The NinjaScript Archive File may contain duplicate method names that already exist on your PC, modify a method signature that other scripts were dependent on, or be missing a required file on either your PC or in the import archive.

                Please help.
                Last edited by fx.practic; 02-08-2019, 01:30 PM.
                fx.practic
                NinjaTrader Ecosystem Vendor - fx.practic

                Comment


                  #9
                  Found this thread: https://ninjatrader.com/support/foru...-a-custom-enum

                  Adding this in cs file not helps.
                  Code:
                  using NinjaTrader.NinjaScript.Indicators.My_Indcator_Folder;
                  Will try other specified ways.
                  fx.practic
                  NinjaTrader Ecosystem Vendor - fx.practic

                  Comment


                    #10
                    Well, I moved my enum to separate global namespace, out of NinjaTrader namespace:
                    Code:
                        namespace MyProject_enums
                        {
                            public enum MyEnum_enum
                            {
                                One,  
                                Two,
                                Free    
                            }
                        }
                    And, I changed all names accordingly:
                    Code:
                    MyProject_enums.MyEnum_enum My_Var;
                    My_Var = MyProject_enums.MyEnum_enum.One;

                    After that, I got multiple errors in NinjaScript generated code section:

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

                    NinjaTrader.NinjaScript.Indicators.Indicator.My_In dicator(double, MyProject_enums .MyEnum_enum , int, byte, byte, byte, byte, bool)' is a 'method' but is used like a 'type' CS0118

                    Moving back MyEnum_enum definition from global namespace inside My_Indicator class let indicator compile again.

                    I really stop understanding what is going on.

                    Also, I tried to import dValueArea indicator from the example above - it compiles fine.


                    UPD 01:
                    Changing indicator namespace from NinjaTrader.NinjaScript.Indicators.My_Indcator_Folder to NinjaTrader.NinjaScript.Indicators let it compile well.
                    Tried to recreate folder through NSEditor - it not helps.
                    (!) Moving an indicator by drag-n-drop NSEditor spoils global enum namespace. Looks like unexpected and not correct behavior.


                    UPD 02:
                    Moving dValueArea indicator to sub-namespace (sub-folder) produce same same errors in it (please, look at attachment).
                    Attached Files
                    Last edited by fx.practic; 02-08-2019, 04:01 PM.
                    fx.practic
                    NinjaTrader Ecosystem Vendor - fx.practic

                    Comment


                      #11
                      Hello fx.practic,

                      I'm writing to know that your message was seen and we will be following up with our findings. As we are approaching our closing time for the day, we will likely have a response during our business hours on Monday.

                      Thanks in advance for your patience.
                      JimNinjaTrader Customer Service

                      Comment


                        #12
                        Thank You Jim.
                        I am looking forward to here Your advice.
                        Last edited by fx.practic; 02-11-2019, 10:29 AM.
                        fx.practic
                        NinjaTrader Ecosystem Vendor - fx.practic

                        Comment


                          #13
                          Hello fx.practic,

                          I am seeing the same symptoms where if we create an enum in a custom namespace and place our NinjaScript in a sub namespace, then the NinjaScript generated code is not including the fully qualified namespace. I am also seeing that if I change the enum to reside globally instead of in the enum's own namespace, then the NinjaScript generated code is correctly applying the fully qualified namespace.

                          I've reported this for further investigation and will update this post as more information becomes available.

                          In the meantime, I would suggest to take either of the approaches with enums:

                          1. If your NinjaScript resides in a sub namespace, use a global enum that does not reside in a separate namespace. Name the enum so it is uniquely associated with your indicator. I.E. MyEnumForThisIndicator. This will help to avoid conflicts if another script uses a different enum with the same name.
                          2. If your NinjaScript does not reside in a sub namespace, you may create a global enum like #1 or create the enum in its own custom namespace.

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

                          Comment


                            #14
                            Hello Jim.
                            Thanks a lot for the answer.
                            Please, please and please - give us the possibility to avoid a mess in public areas.
                            fx.practic
                            NinjaTrader Ecosystem Vendor - fx.practic

                            Comment


                              #15
                              Hello fx.practic,

                              I'm following up on this matter after it has been fully reviewed.

                              NinjaTrader parses the script to create the NinjaScript generated code. There are going to be some expected limitations with the way NinjaTrader reads the script and how that NinjaScript Generated Code gets created. We are hitting some of these limitations in this thread.

                              As a best practice to avoid hitting these limitations, I would suggest to ensure that the indicator class is at the top of the script without any other custom namespaces or classes ahead of it.

                              For example, moving the namespace _dValueEnums block beneath the namespace NinjaTrader.NinjaScript.Indicators.MySubNamespace block will not produce the same issues presented here.

                              Please let us know if you have any additional questions.
                              JimNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Fran888, 02-16-2024, 10:48 AM
                              3 responses
                              44 views
                              0 likes
                              Last Post Sam2515
                              by Sam2515
                               
                              Started by martin70, 03-24-2023, 04:58 AM
                              15 responses
                              114 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by The_Sec, Today, 02:29 PM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              2 responses
                              31 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by Mindset, 05-06-2023, 09:03 PM
                              10 responses
                              265 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Working...
                              X