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

DLL fails to load

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

    DLL fails to load

    Hi,

    I am trying to use a dll (called myStuff.IO.dll) in my indicator and even though I have referenced the dll, and the indicator compiles, when I run the indicator I get the following error message:

    Error on calling 'OnStartUp' method for indicator 'XXX': Could not load file or assembly myStuff.IO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

    It appears that the script cannot find the dll file even though it has been properly referenced.

    Any suggestions woul dbe greatly appreciated. Thank you.

    #2
    Hi Zeos6,

    It sounds like you've done most of the steps. You could try exporting a demo indicator to see how an assembly functions in NinjaTrader. Create a dummy indicator, export as an assembly and then import back in. You have to delete the source file before you can import back in.

    That will let you know if the basic functionality works. If that works and you're still having issues with your custom dll, then theres likely a problem with the file or how you're accessing its methods/ properties. If you can send the file and instructions for accessing some of its items we will give a run here to compare. You can post to the forums or send email to support 'at' ninjatrader 'dot' com.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi,
      I have partially solved this. I had to copy the dll into the \bin\custom folder, close down NT and then restart. This solved the issue but the question now is, why did it not find the file when I referenced it from my external development library that was outside the \bin\custom folder? I referenced the dll correctly and I specified a full path. Thank you.

      Comment


        #4
        Glad to hear you were able to resolve. The custom assemblies should be installed in bin\custom. This is the best practice to ensure NT can access.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Hi Ryan,

          I understand this now but why can I reference a dll from anywhere? Shouldn't referencing from outside the \bin\custom folder fail? I found this misleading because I thought that if I can reference from any folder, then the script should see the reference. I am still puzzled by this.

          Comment


            #6
            Unfortunately I do not have the design details. It can be hit or miss when placed outside this directory so we encourage you to install these in the directory where it works best.

            http://www.ninjatrader.com/support/h...rd_party_d.htm
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              HI Ryan,

              Thank you for letting me know. I will keep this in mind for future developments.

              One more question: If my external dll also requires data from an external data file, where should the data file be placed? Currently I have it placed externally to NT 7 and even though the indicator has the full path to the data file and compiles, it is not reading the external data. Please let me know. Thank you.

              Comment


                #8
                Unfortunately there are no guidelines for this and is beyond our scope of support. You'll have to debug the functionality of your custom dll.

                We support NinjaScript that is documented in our help guide and reference samples. There will always be more you are capable of doing in C#/.net than we support.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by Zeos6 View Post
                  HI Ryan,

                  Thank you for letting me know. I will keep this in mind for future developments.

                  One more question: If my external dll also requires data from an external data file, where should the data file be placed? Currently I have it placed externally to NT 7 and even though the indicator has the full path to the data file and compiles, it is not reading the external data. Please let me know. Thank you.
                  This may be trivial, and you may have already checked, but this is sounding like a path reference problem. Are you sure that you have correctly escaped the backslashes in the path? I had the devil of a time with such a problem once.

                  Comment


                    #10
                    Hi Koganam,

                    Yes, I did escape the backslashes correctly. I am aware of this issue as I have run into this in the past. I am, however, wondering if the data file needs to be in the \bin\custom folder as well. I will check this out.

                    Comment


                      #11
                      Hi,
                      For anyone interested. If your external assembly is placed in the folder:

                      1. MyDocuments\NinjaTrader 7\bin\Custom:
                      The indicator compiles and finds and is able to use the assembly.
                      2. MyDocuments\NinjaTrader 7\bin
                      The indicator compiles but does NOT find and is not able to use the assembly.
                      3. ProgramFiles\NinjaTrader 7\bin\Custom
                      The indicator compiles but does NOT find and is not able to use the assembly.
                      4. ProgramFiles\NinjaTrader 7\bin
                      The indicator compiles and finds and is able to use the assembly.

                      Any external data files used by the assembly can be placed anywhere as long as the path name is referenced correctly. If you plan to place the data file in the ProgramFiles\NinjaTrader 7\bin folder, you can reference your data file as @"myData.xxx" and omit the fulll path name.

                      I have place my external data file for the assembly in the MyDocuments\NinjaTrader 7\bin\Custom folder.

                      Comment


                        #12
                        Thank you for sharing this, Zeos6.
                        Ryan M.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by judysamnt7, 03-13-2023, 09:11 AM
                        4 responses
                        59 views
                        0 likes
                        Last Post DynamicTest  
                        Started by ScottWalsh, Today, 06:52 PM
                        4 responses
                        36 views
                        0 likes
                        Last Post ScottWalsh  
                        Started by olisav57, Today, 07:39 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post olisav57  
                        Started by trilliantrader, Today, 03:01 PM
                        2 responses
                        22 views
                        0 likes
                        Last Post helpwanted  
                        Started by cre8able, Today, 07:24 PM
                        0 responses
                        10 views
                        0 likes
                        Last Post cre8able  
                        Working...
                        X