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

common DLL for multiple indicators

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

    common DLL for multiple indicators

    Hi!

    I am developing different Indicators (NT8 - I am using VS2019 launched from within the NT Script window), but have some methods that I do in all of them and am trying to figure out how to put these method in a separate class/DLL.

    It seems that I cannot just build a DLL and point to it Dependencies. Nor just put it in the \Documents\NinjaTrader 8\bin\Custom folder?

    Also I am aware of that I need to add the DLL into the distribution .zip (https://ninjatrader.com/support/help...tml?editor.htm) once I shall distribute.

    Does anyone have any direction to point me towards other than the helpguides?

    Appreciate any feed back, thank you.
    Regards K
    Trasss_Kenneth
    NinjaTrader Ecosystem Vendor - Trasss Trading Assistance Solutions

    #2
    Hello Trasss_Kenneth,

    Welcome to the NinjaTrader Forums.

    You could consider using static methods in a NinjaScript AddOn. See the MySharedMethodsAddOnExample script in the forum thread below which demonstrates creating static methods in an AddOn.

    MySharedMethodsAddOnExample: https://ninjatrader.com/support/foru...est#post733956

    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      You could create your own abstract base class,
      something like MyIndicatorBase, and put your
      common code in there.

      Study this example.

      Comment


        #4
        Thank you very, very much for the two very useful yet different approaches

        Just did some testing with both - AddOn works fine but the abstract approach(which I find most suitable) gives me an issue when creating my own abstract indicator - when NT compiles the code it adds the "neither change nor remove" code, which it does not do on Strategies - any ideas?:

        Click image for larger version

Name:	AbstractClassError.png
Views:	284
Size:	85.3 KB
ID:	1180230 at the end
        Thanks again

        Last edited by Trasss_Kenneth; 12-01-2021, 12:54 PM. Reason: did at first have success, but i discovered that the issue with the indicator, so edited my answer
        Trasss_Kenneth
        NinjaTrader Ecosystem Vendor - Trasss Trading Assistance Solutions

        Comment


          #5
          Exit NinjaTrader

          Using a different editor, go into the abstract base class file and delete that code.

          Start NinjaTrader

          Try compiling a different file, something other than the abstract base class file.

          Does it still generate the wrappers?

          Can you attach your code?

          Comment


            #6
            Also, try moving your abstract base class file to the Addon folder ...

            Comment


              #7
              Hello Trasss_Kenneth,

              Thanks for your note.

              Abstract classes are a C# concept. There can be limitations when using advanced C# concepts in NinjaTrader.

              As of now, we do not have any documented or supported examples that can be used to navigate this path.

              You may find using partial classes to be helpful. See the attached reference samples demonstrating using partial classes.

              Let us know if we may further assist.
              Attached Files
              Brandon H.NinjaTrader Customer Service

              Comment


                #8
                Thanks for the followup.
                Will try your suggestions bltdavid and look into the partial classes NinjaTrader_BrandonH
                be back..(next week)
                Trasss_Kenneth
                NinjaTrader Ecosystem Vendor - Trasss Trading Assistance Solutions

                Comment


                  #9
                  Another solution for avoiding generated code is here.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by yertle, Yesterday, 08:38 AM
                  7 responses
                  28 views
                  0 likes
                  Last Post yertle
                  by yertle
                   
                  Started by bmartz, 03-12-2024, 06:12 AM
                  2 responses
                  21 views
                  0 likes
                  Last Post bmartz
                  by bmartz
                   
                  Started by funk10101, Today, 12:02 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post funk10101  
                  Started by gravdigaz6, Yesterday, 11:40 PM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by MarianApalaghiei, Yesterday, 10:49 PM
                  3 responses
                  10 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X