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

Enums and exporting multiple dlls

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

    Enums and exporting multiple dlls

    I created a few indicators and I exported them in two different packages. I also created an independent enum indicator. When compiling would I make 3 dlls
    Dll1 package a dll2 package b and dll 3 my enum class?

    The reason is my trace says my emun already exist in package a

    #2
    Hello,

    Thank you for the post.

    In the situation where you are creating a shared enum and other optional products, you would likely need to make 3 exports, one being only the enum by its self. The other two exports would then need to reference your enum DLL during the export and not the enums source code. Referencing the source code in either of the other packages will include the enum, upon importing you would get an error.

    The process would be as follows:
    1. Create the enum and finalize it with all the options you need, you won't be able to edit this later easily.
    2. After the enum is done, export only the enum as a compiled assembly / protected if needed.
    3. Remove the source code for the enum
    4. Import the compiled assembly with the enum.


    From this point, you can now reference the enum from the assembly using its full name, for example:

    Code:
    public NinjaTrader.Indicator.TestEnum MyEnum {get;set;}
    and

    Code:
    MyEnum  = public NinjaTrader.Indicator.TestEnum MyEnum.SomeEnumValue;

    Using the full namespace name like this would be necessary to ensure the files can export correctly.

    After exporting, you would need to include the assembly with the additional references text file. Also, you will need to append the dll file to your final exports zip files. We have a short guide here: https://ninjatrader.com/support/help..._procedure.htm

    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jesse; 10-03-2017, 12:37 PM.
    JesseNinjaTrader Customer Service

    Comment


      #3
      thank you now I have 1 more question


      I went through the link and not sure what you mean by
      you will need to append the dll file to your final exports zip files.

      I have zipped dlls before but because enum is a seperate class

      do you have to do some appending?

      Comment


        #4
        Hello,

        It would depend on how you want to package your final exports. You can either have the client import the enum dll first to ensure the reference exists before importing the other indicators. Or the enum dll can be included as an AdditionalReferences.txt item for each individual zip file. I had noted you could include the enum dll as an additional reference dll with each zip file if you would like, this would prevent the user from importing multiple zips in a specific order.

        Please let me know if I may be of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          I think i got it. I compiled myenum and now I see my opensource indicators is referencing the enum.dll I didn' realize I needed a compiled enum.dll to export .

          Now my other indicator packages are working.

          Thank you


          lastly on the enum indicator side is there a way to hide it form the indicator list?

          I used Name = string.Empty; in the initialize and it will hide it kind of but there is space on the top when you add indicator
          Last edited by ballboy11; 10-03-2017, 01:39 PM.

          Comment


            #6
            Hello,

            In your indicator enum, rather than making an Indicator, you can just use an Enum in a Namespace and omit the Indicator class. Here is a simple example:
            Code:
            namespace NinjaTrader.Indicator
            {
                public enum MyCustomEnum{
            		one,
            		two
            	}
            }
            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by mmenigma, Yesterday, 03:25 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by kujista, Today, 05:44 AM
            0 responses
            7 views
            0 likes
            Last Post kujista
            by kujista
             
            Started by ZenCortexCLICK, Today, 04:58 AM
            0 responses
            9 views
            0 likes
            Last Post ZenCortexCLICK  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            172 responses
            2,281 views
            0 likes
            Last Post sidlercom80  
            Started by Irukandji, Yesterday, 02:53 AM
            2 responses
            18 views
            0 likes
            Last Post Irukandji  
            Working...
            X