• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


Custom Assembly Folder Location

  • Filter
  • Time
  • Show
Clear All
new posts

    Custom Assembly Folder Location

    I wrote a WPF assembly and want to reference it from an indicator. What is the recommended location for the project? I find that if I put it anywhere within the Custom folder tree that the source code for it is picked up as part of the build for the NinjaTraderCustom.DLL and I end up getting duplicate symbol references.

    I had started by trying to include the source code w/in the NinjaTrader8\AddOns folder but the problem with that was that I could not get the file association between my MainWindow.xaml and the code behind file for it - MainWindow.xmml.cs to work. Also, there's some code that gets generated by Visual Studio ( or the compiler ) to create some bootstrapping for a WPF window and that code does not get generated from within the NinjaTrader.Custom project. So I moved the code to a separate assembly where it now compiles fine on it's own... The only problem now is integrating with NinjaTrader.Custom. I added a references form NinjaTrader.Custom to my assembly but I get duplicate symbol references.

    What's the best practice for this situation? Should I put the project outside of the NinjaTrader 8 folder?

    Hello Brillo, and thank you for your question.

    While NinjaTrader 8 does contain add-on support, you are correct in that there is a very high likelihood of symbol collision if you include wpf code you are not inheriting directly from Ninja. The best approach I can think of would be to use this publicly available MSDN documentation to turn your own WPF code into a dll,


    Then creating an add-on through NinjaTrader 8,


    And have the add-on use the MSDN C# DllImport method, publicly available documentation here,


    We are happy to help with any Ninja questions that come up.
    Jessica P.NinjaTrader Customer Service


      Thank you Jessica.
      I will take the approach you suggested.

      Just for furthering my understanding of the NT8 folder structure:

      From browsing the AddOn documentation it appears that an NT8 AddOn is an extension of ( or additional ) user interface. For example, if a vendor writes their own Time And Sales window, they would be able to integrate it into NT8 as an AddOn.

      The code for this is intended to be put under AddOn? And I suppose that most vendors would then be putting just a small stub of code there and using the techniques you described to reference a separate DLL?

      Aside from this, is there any guidance for the intent of each folder in the NT8 tree? I tend to write re-usable code for my indicators and strategies. Some of that code is so general purpose that I would not categorize it as "indicator" or "strategy" and I don't want to put it anywhere under either Indicators or Strategies.
      However if I export the indicator or strategy I need to be able to choose the supporting code to go with it and I find that I must put it under either AddOns, Strategies or Indicators to be able to export it. For this reason I've been putting this supporting code under the AddOns folder. But it is not actually extending the UI of NT. Is there another folder that I can put this code in and still be able to export it?


        That is an excellent question regarding the file tree. The intent was to have e.g. all the code that inherits from Indicator to go into the Indicators folder, all the code that inherits from MarketAnalyzerColumn to go into the MarketAnalyzerColumns folder, etc.

        Supporting library code of the type you are describing has 2 traditional locations left over from NT7 :

        • Directly inside your bin\Custom folder. This is an especially appropriate folder for .dll files
        • Next to the indicators or strategies they support, e.g. NT7's bin\Custom\Indicator\UserDefinedMethods.cs . Even though this is not an Indicator, it is meant to be used exclusively by Indicators, just as the copy in the Strategy folder is meant to be used exclusively by Strategies.

        The add-on folder should contain everything Ninja interacts with directly when making a component that extends Ninja and does not inherit from any of the other classes. Otherwise, I would recommend using one of the other two traditional locations.

        Ninja will link and compile everything in your bin\Custom folder, so you do have some flexibility. I hope the above information helps, if we can clarify anything further please let us know.
        Jessica P.NinjaTrader Customer Service


          Originally posted by NinjaTrader_JessicaP View Post
          Ninja will link and compile everything in your bin\Custom folder, so you do have some flexibility. I hope the above information helps, if we can clarify anything further please let us know.
          Yes I can create any folder I want under \bin\Custom and my general purpose code is compiled there...
          BUT I can not export it with my indicator or strategy. This is a problem and consequently I'm putting all of my supporting code in the AddOns. It works but I don't think it was the intent and so I'm recommending that Ninja should have one more root folder defined that's available to export and we can put our general purpose code in there ( in sub folders under it )


            Thank you Brillo,

            I have submitted a feature request to the product management team for the following feature :

            This user would like a bin/Custom/General folder that is tracked by Ninja's packager when exporting NinjaScript assemblies
            I will follow up with more information as soon as it's available. If the feature requests already exists, a vote will be added to it.

            Please let us know if there are any other ways we can help.
            Jessica P.NinjaTrader Customer Service


            Latest Posts


            Topics Statistics Last Post
            Started by Trader17, Today, 04:07 PM
            0 responses
            1 view
            Last Post Trader17  
            Started by GussJ, Today, 01:30 PM
            2 responses
            Last Post GussJ
            by GussJ
            Started by GARZONJ, Today, 12:25 PM
            3 responses
            Last Post NinjaTrader_PaulH  
            Started by RandanAL, Today, 11:53 AM
            1 response
            Last Post NinjaTrader_ChelseaB  
            Started by yeshujbp, 07-21-2019, 02:40 PM
            2 responses
            Last Post omololu
            by omololu