• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.
          https://ninjatrader.com/support/foru...nsoft-json-dll
          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 tonynt, Today, 02:18 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_JoshG  
            Started by denalek2419, Today, 01:46 PM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by REI140205, Today, 12:58 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Jim  
            Started by Aditrade, Today, 12:33 PM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_Kate  
            Started by music_p13, Today, 12:22 PM
            2 responses
            11 views
            0 likes
            Last Post music_p13  
            Working...
            X