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

Can't reference a dll file

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

    Can't reference a dll file

    For some reason I am not being able to reference a dll file... it keeps getting me an error message saying it could not find the namespace where the file was created.
    I did set the framework down to 3.5 and the dll was just a simple implementation of a class that contains a function that takes two integers and returns one multiplied by the other, just for testing.
    On my strategy I instantiate an object from the dll file and call for the multiply function through the object passing two integers, but when I try to build it, NT complains it does not find the namespace even though I referenced the dll after copying it to the location I wanted. I even recorded a video to show what's going on ...
    Any feedback is greatly appreciated.
    © Copyright 2012-2021- www.eddiedemeira.com /All rights reserved

    #2
    Hello Eddie De Meira,

    NinjaTrader 8 is currently using .NET 4.8. Feature request ID# 14630.


    Is this a .NET 4.8 targeted assembly?

    Is this your assembly? Was this exported by NinjaTrader as a dll?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,
      thanks for replying to my message
      Yes, this is my assembly and it was not exported by Ninja Trader platform.
      I will change the framework to .NET4.8 and export a dll from NT to ensure I can modify and rebuild it before importing again to the platform, I will see if this works.

      How do I export an assembly from Ninja Trader, if I open the project in Visual Studio, I don't see the option to neither create a library file nor export the file as an assembly... How do I do that?
      Thanks
      Last edited by Eddie De Meira; 05-03-2021, 04:36 AM.

      Comment


        #4
        Yeap... I am really trying here but nothing seems to work...

        Is this possibly a bug on NT?
        I just would like to export my strategies as assemblies due to security purposes because they are restricted to IP (Intellectual Properties) limitations.
        I tried searching online and in the forum but so far I couldn't find an answer...

        Thanks

        Comment


          #5
          Hello Eddie De Meira,

          An incompatible dll that is exported outside of NinjaTrader would not be a bug in NinjaTrader.

          I can provided you with a script exported from NinjaTrader as a dll if you want to try that.

          3rd party managed dlls can be referenced as long as they are not unmanaged and are targeting .NET 4.8, however this would fall outside of what is directly supported by NinjaTrader support.
          This thread will remain open for any community members that would like to assist with creating custom 3rd party dlls outside of NinjaTrader.


          In NinjaTrader, you can export your code as an assembly (.dll) to prevent this code from being read or modified, and optionally you can use Agile.NET to prevent the code from being un-assembled (deobfuscated).
          To export your script do the following:
          1. Click Tools -> Export -> NinjaScript
          2. Click the 'add' link -> check the box(es) for the script(s) you want to include -> click OK
          3. Check the option labelled Export as compiled assembly
          4. If you have Agile.NET installed and would like to use this, check the box labelled Protect compiled assembly
          5. Click Export -> enter a unique name for the file in the Dialog window
          6. Choose a save location -> click Save
          7. Click OK to clear the export location message
          By default your exported file will be in the following location:
          • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
          Below is a link to the help guide on Exporting NinjaScripts.
          http://ninjatrader.com/support/helpG...-us/export.htm

          Below is a link to the help guide on Agile.NET protection.
          http://ninjatrader.com/support/helpG...l_security.htm

          You can purchase Agile.NET here.
          Agile.net is a best-in-class obfuscator for .NET platform. Agile.net protects .NET applications against piracy, code theft & malicious tampering.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            An incompatible dll that is exported outside of NinjaTrader would not be a bug in NinjaTrader.
            The file is exported through NT, please see the link below to understand why I asked if this is a NT bug.

            3rd party managed dlls can be referenced as long as they are not unmanaged
            Not sure what you mean here, the very nature of C# is being managed code. Isn't it?
            But if you meant to say that the imported dll is done in C++ or some other unmanaged language, then, the answer is no, the dll is done using .NET 4.8 and in C#.
            © Copyright 2012-2021- www.eddiedemeira.com /All rights reserved

            Comment


              #7
              Hello Eddie De Meira,

              Apologies, my understanding was that from your post #3 you have stated this was not exported through NinjaTrader.

              As this was exported with NinjaTrader, I would like to take a look at the open source script and ensure there are no references to 3rd party assemblies, and that there are no missing dependencies.

              Please send an email to scriptingsupport [at] ninjatrader [dot] com so that I may request the open source script so that I may test exporting this on my end. In the email please include a link to this forum thread.
              Last edited by NinjaTrader_ChelseaB; 05-03-2021, 11:49 AM.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thanks Chelsea,

                I already sent the email and the files attached.
                Cheers,
                Eddie

                Comment


                  #9
                  Hi Chelsea,
                  Just for the record, I figured out what was going on...
                  Early on, when I installed NT 8, I moved all the "@" files to a folder I created and named Samples under Strategies ( I thought they were sample codes only). This is because I thought by doing this way, I would have the files distributed in a less clustered way, and I've been using NT8 so far without any noticeable problems ever since.
                  It turns out that when I try to export files, the Export feature needs to reference to one of the files called @Strategy.cs within the Strategies folder.
                  Because I moved this file to a different folder, the export feature was not being able to complete its job.
                  So, I put it back where it belongs and now I can export .cs and/or .dll files without any errors.
                  Then, all I need to do is adding a reference to the dll file I exported (within my solution) and I can instantiate any object derived from it.

                  Problem solved!

                  Thanks a lot for your help and patience.
                  Cheers,
                  Eddie
                  Last edited by Eddie De Meira; 05-04-2021, 04:29 AM.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by GussJ, 03-04-2020, 03:11 PM
                  15 responses
                  3,271 views
                  0 likes
                  Last Post xiinteractive  
                  Started by Tim-c, Today, 02:10 PM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by Taddypole, Today, 02:47 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post Taddypole  
                  Started by chbruno, 04-24-2024, 04:10 PM
                  4 responses
                  51 views
                  0 likes
                  Last Post chbruno
                  by chbruno
                   
                  Started by TraderG23, 12-08-2023, 07:56 AM
                  10 responses
                  403 views
                  1 like
                  Last Post beobast
                  by beobast
                   
                  Working...
                  X