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

Best place to define enum?

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

    Best place to define enum?

    At the present time I have only one AddOn that I've developed for NinjaTrader, but I may develop others in the future. I'd like to define an enum that my present AddOn will use, and that future AddOns might use. Should I simply define my enum at the top of the .cs file for my present AddOn (say below the "using" declarations), or is there a better location for it? Thank you for any guidance you might provide.

    #2
    Hello NtFan,

    Thanks for the post.

    This really depends on how you want the final export/s to be. Is this going to be a source code export or compiled, also will this be one export zip file or are you going to release multiple zips?

    For a source code export, you can make this a separate .cs file and for each export you would select the enums .cs file as part of the export. During the import it will ask to replace it if it exists.

    For a compiled export:

    If this is one zip file you can put it at the top of one file in a namespace or make a separate .cs file and put your enum in a specific namespace, all addons you export in that zip can share that enum by using its fully qualified name MyNamespace.MyEnum.

    If these are separate zips you will need to put the enum in a separate .cs file and then export that as a compiled reference. You can then delete the source code for the enum and re import it as a compiled reference. When you export each zip file you can select the reference as a requirement in the export dialog. This is required so that each individual zip references and imports only 1 copy of the enum code or makes sure its present. This also requires adding the dll manually to the zip using these steps: https://ninjatrader.com/support/help...esOrNativeDlls

    I look forward to being of further assistance.

    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    31 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    2 views
    0 likes
    Last Post tkaboris  
    Started by GussJ, 03-04-2020, 03:11 PM
    16 responses
    3,282 views
    0 likes
    Last Post Leafcutter  
    Started by WHICKED, Today, 12:45 PM
    2 responses
    20 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Working...
    X