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

Does Additional DLL Have to Be in the Custom Folder?

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

    Does Additional DLL Have to Be in the Custom Folder?

    I have an additional DLL of basic classes that I've created as a class library project.

    It doesn't use any NinjaTrader objects or references. It just provides some basic math functions.

    Is it a requirement that additional DLLs be in the Custom folder?

    I should add that everything works when I put the DLL in the Custom folder. But it doesn't if the DLL is not in the Custom folder. That is, I add the reference normally, but the DLL is outside of the Custom folder when I do and there is no copy of it in the Custom folder.

    I get errors likes "Property not found" or "Failed to load assembly."

    It seems pretty obvious based on this behavior that additional DLLs are required to be in the Custom folder, but I'd just like to understand the official guidance or specific limitations.
    Last edited by BarzTrading; 03-10-2019, 09:34 AM.

    #2
    Hello BarzTrading,

    If you want the script to be importable when included with an export, then yes, it needs to be referenced in the Documents\NinjaTrader 8\bin\Custom folder.

    If this is just on your local computer and you don't care about importing / exporting, then from my understanding no, you can put it anywhere and add a custom reference to it wherever it is.
    As an example, sometimes its necessary to reference .NET dlls in their system location.

    If the script has an accompanying .cs file, this would need to be in the custom folder.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      I'm able to compile everything ok when the DLL is not in the custom folder, but I still run into a problem trying to use the code in an indicator.

      I've attached a simple class library project (NinjaMastery.Static.zip) which I have placed under the "Documents\NinjaTrader 8\bin" folder at the same level as the Custom project (see screenshot).

      I build that project and its output in place and add a reference to NinjaTrader from there rather than copying the DLL to the Custom folder.

      I've created a bare bones indicator (StaticInd1.zip) in the "Custom\Indicators" folder which uses the Static1 class from the library.

      One benefit of doing things this way appears to be that Visual Studio can overwrite the DLL even though it is referenced by NinjaTrader and we can recompile without having to close NinjaTrader.

      Using xcopy in a post-build event to copy the DLL to the Custom folder fails because it cannot overwrite a DLL that is referenced by NinjaTrader.

      Pressing "F5" in the NinjaScript Editor, everything compiles just fine.

      Then I open a chart and try to add the indicator.

      The Log shows the following error message: (see screenshot)

      Indicator 'Static Indicator 1': Error on calling 'OnBarUpdate' method on bar 0: Could not load file or assembly 'NinjaMastery.Static, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      NOTE: I'm purposely instantiating the class in OnBarUpdate so the error doesn't occur until we try to add the indicator to the chart.

      If I move the DLL to the Custom folder and update the NinjaTrader reference, then restart NinjaTrader. Everything works fine.
      Attached Files
      Last edited by BarzTrading; 03-11-2019, 10:53 AM.

      Comment


        #4
        I tried something else: I changed the build output folder of the the class library project to the Custom folder. Now a build of the class library project fails if NinjaTrader is open because it can't overwrite the DLL, the same thing that occurs with xcopy in a post-build event when we copy the build outputs to the Custom folder.

        It does appear NinjaTrader is doing something different if the referenced DLL is in the Custom folder.

        Comment


          #5
          Hello BarzTrading,

          I found an older post where Jesse has confirmed external dlls must be the Custom folder.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Great, thanks. That's makes sense given what I was seeing.

            For a minute there I thought we might have a way to update additional projects without having to close/reopen NinjaTrader with every change.

            Anyway, I'm glad to have the confirmation that all DLL references need to be in the Custom folder.

            Thanks,


            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,605 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            8 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            4 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            13 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X