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

Export fails for indicators that have referenced .dlls

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

    Export fails for indicators that have referenced .dlls

    Hi -

    I have a bare bones indicator that references a simple .dll that was developed with .Net Framework 4.5. When I add the reference and compile the indicator it works just fine.

    When I try to export the indicator, I get the following error:

    Error compiling export assembly: c:\Users\Owner\Documents\NinjaTrader 8\bin\Custom\Indicators\FWTestIndicator.cs(47,13) : error CS0103: The name 'FWHelper' does not exist in the current context

    I have tried this with several indicator and several .dll, all to get the same error.

    Please advise on how to fix this.

    Find the test indicator file, the source code for the .dll, and the .dll itself within the attached 'Export Problem.zip' file Export Problem.zip

    Thanks for your help.

    #2
    Hello kweiss,

    Thank you for providing the sample that helps to see the problem.

    In this case you would get this error if you are not selected the reference during the export, are you also selecting the reference when you go to export the file?

    There is a dropdown list of items that can be exported which includes "References". When you export with a dll reference you will need to do this, it also warns you that you need to manually modify the zip afterwards to add the file. You can find the steps for that here: https://ninjatrader.com/support/help...esOrNativeDlls


    I would also suggest using the fully qualified name when calling any referenced code. When working with compiled exports it is best not to rely on using statements, I see that you have used the indicators namespace so that will work however for other libraries or items not in a NinjaScript namespace I always suggest using the following format:

    Code:
    DateTime x = NinjaTrader.NinjaScript.Indicators.FWHelper.GetDate();

    You may also have an interest in the addon sample we provide for visual studio, it has a build action which copies the resulting DLL to the user data folder. This can be helpful if you have many changes to make, you can automate copying the file at least. This still requires you to exit the platform before the copy and restart to see changes.
    https://ninjatrader.com/support/help...t_overview.htm (AddOn Development Environment (Visual Studio Advanced))

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you for your answer. It has helped me to export my indicator, however, that indicator will not import properly. Now I am getting the following error when I try import the indicator:

      Failed to restore Indicator 'NinjaTrader.NinjaScript.Indicators.TradeSafe.Indi cators.TradeSafeTrend'. Most likely (a) the implementation changed or (b) one or more properties have been renamed or removed or (c) the custom assembly which implements this Indicator no longer is there.

      Find attached a bare-bones test project and the Ninja test indicator.

      Please advise on how to import this.

      Thank you.
      Attached Files

      Comment


        #4
        Hello kweiss,

        One problem I can see is that you have selected .NET Standard projects, you would need to make a .NET framework project to be compatible. If you are using VS 2019 that would be under C# -> Windows -> Library -> Class Library (.NET Framework). It would need to be .NET Framework 4.5 or less.

        Please try to delete the existing library you have and recreate/re export under .net framework and try again. If that fails again please provide the updated project as you did before.


        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thank you for your suggestion. While it fixed the previous problem, I still can not import the indicator. I am now getting the following errors:
          Error compiling import assembly: error CS0006: Metadata file 'F45.Main' could not be found
          Error compiling import assembly: error CS0006: Metadata file 'F45.Common' could not be found
          I have attached the exported Add-on, the original indicator and the .Net project the created F45.Main and F45.Common.

          Thank you for all your help.
          Attached Files

          Comment


            #6
            Hello kweiss,

            Have you completed the steps from the help guide here:


            After you export as a compiled assembly you get a zip with a .txt file in it, that only explains what references it needs. For your development PC as long as you have the references in NinjaTrader you could import this to test it. On any other PC or if you remove the references it will not import unless you complete the manual addition of the .DLLs to the .ZIP like described in the help guide. This allows the import to copy/reference the dlls.

            I was able to see this export/import successfully on my end.


            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Hi -

              I am a bit confused. Please look at the uploaded FW45Test.Zip. You will see the two .dlls have been manually added as explained in the help text. Please upload indicator zip so I can see exactly how it is setup.


              Thank you.

              Comment


                #8
                Hello kweiss,

                Did you manually make the AdditionalReferences.txt or did you export the references using the export menu?

                I made no changes to the files you provided, just re exported using the export window and that file was able to import successfully. I also removed the references before the import and it was able to import the references in the zip. You would need to select both references in the export and then your AdditionalReferences file should look like the following once generated:

                *MyDocuments*\NinjaTrader 8\bin\Custom\F45.Main.dll
                *MyDocuments*\NinjaTrader 8\bin\Custom\F45.Common.dll


                If you are still having trouble please list the specific steps you used through the export process.

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Waxavi, Today, 02:10 AM
                0 responses
                5 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by TradeForge, Today, 02:09 AM
                0 responses
                11 views
                0 likes
                Last Post TradeForge  
                Started by Waxavi, Today, 02:00 AM
                0 responses
                2 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by elirion, Today, 01:36 AM
                0 responses
                4 views
                0 likes
                Last Post elirion
                by elirion
                 
                Started by gentlebenthebear, Today, 01:30 AM
                0 responses
                5 views
                0 likes
                Last Post gentlebenthebear  
                Working...
                X