Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Assembly Folder Location

Collapse
X
 
  • 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?

    #2
    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

    Comment


      #3
      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?

      Comment


        #4
        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

        Comment


          #5
          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 )

          Comment


            #6
            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

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by kevinenergy, 02-17-2023, 12:42 PM
            115 responses
            2,699 views
            1 like
            Last Post kevinenergy  
            Started by prdecast, Today, 06:07 AM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by Christopher_R, Today, 12:29 AM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by chartchart, 05-19-2021, 04:14 PM
            3 responses
            577 views
            1 like
            Last Post NinjaTrader_Gaby  
            Started by bsbisme, Yesterday, 02:08 PM
            1 response
            15 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X