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

Custom indicators and strategies cannot reference external assemblies

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

    Custom indicators and strategies cannot reference external assemblies

    Any idea why whenever I add a reference to an external assembly to a custom indicator or strategy I get the following exception message?

    Failed to call method 'Initialize' for strategy 'ExampleStrategy': Could not load file or assembly 'ExampleStrategy.Core Version=1.0.0.0 Culture=neutral PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

    The DLLs are in the correct place and I can reference them fine from outside NinjaTrader.

    Thanks

    #2
    P.S. I'm guessing this is a permissions problem as I've had this issue before...

    Comment


      #3
      The imported assembly is dependent on a different assembly which is not available. Please contact the author of the imported assembly. He/she should know which dependency is missing.

      Edit: deleted some posts, since they pointed to wrong direction.

      Comment


        #4
        Originally posted by NinjaTrader_Dierk View Post
        The imported assembly is dependent on a different assembly which is not available. Please contact the author of the imported assembly. He/she should know which dependency is missing.

        Edit: deleted some posts, since they pointed to wrong direction.
        My fault. Yesterday was a veeeeeeeery long day and I'd forgotten to move the referenced DLL from the Visual Studio build directory into the NT bin directory.

        Sorry for wasting your time Dierk.

        Comment


          #5
          Glad it's resolved for you.

          Comment


            #6
            Hello,

            I am also facing the same error message even after I have moved the DLL to the C:\Users\mtthwbrnd\Documents\NinjaTrader 6.5\bin\Custom directory.

            The DLL I am using is from here:


            And is called Interop.JDLLServerLib.dll

            The intellisense recognises all of the things that are defined by the dll, so it must have found the file.

            Does anybody have any ideas as to what might be wrong?

            The line which generates the error is:
            Code:
                            JDLLServerClass j = new JDLLServerClass();
            And the error message is:
            14/12/2009 13:02:34,Strategy,Error on calling 'OnBarUpdate' method for strategy 'JayServerExample': Could not load file or assembly 'Interop.JDLLServerLib, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.,

            Thanks,
            Matthew.


            PS.

            The full program is:
            Code:
            #region Using declarations
            using System;
            using System.ComponentModel;
            using System.Diagnostics;
            using System.Drawing;
            using System.Drawing.Drawing2D;
            using System.Xml.Serialization;
            using NinjaTrader.Cbi;
            using NinjaTrader.Data;
            using NinjaTrader.Indicator;
            using NinjaTrader.Gui.Chart;
            using NinjaTrader.Strategy;
            
            using JDLLServerLib;
            
            #endregion
            
            // This namespace holds all strategies and is required. Do not change it.
            namespace NinjaTrader.Strategy
            {
                /// <summary>
                /// Example of communcation with J
                /// </summary>
                [Description("Example of communcation with J")]
                public class JayServerExample : Strategy
                {
                    #region Variables
                    // Wizard generated variables
                    // User defined variables (add any user defined variables below)
                    #endregion
            
                    /// <summary>
                    /// This method is used to configure the strategy and is called once before any strategy method is called.
                    /// </summary>
                    protected override void Initialize()
                    {
                        CalculateOnBarClose = true;
                    }
            
                    /// <summary>
                    /// Called on each bar update event (incoming tick)
                    /// </summary>
                    protected override void OnBarUpdate()
                    {
                        Print(Bars.Count);
                        Print("hello!");
            //            if (Bars.Count == 0) {
                            JDLLServerClass j = new JDLLServerClass(); 
            //                object result;
            //                int status = j.DoR("2| !/~i.4", out result);
            //                Print(
            //                string.Format("J DoR ended with status {0} and result\n{1}",
            //                    status, result));
            //            }
                    }
            
                    #region Properties
                    #endregion
                }
            }

            Comment


              #7
              mtthwbrnd,

              We are not sure if that is the correct directory. You could try some other ones or contact the author to see which one to use. You could try <Program Files>\NinjaTrader 6.5\bin.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Hi Josh,

                I do not have a "NinjaTrader 6.5" directory in my "Program Files" directory.

                I am using Windows 7 and it is in the "Program Files (x86)" directory .. so I have put it in "<Program Files (x86)>\NinjaTrader 6.5\bin" instead. I don't know if that could be a the problem?

                but it still gives the same error anyhow :-(.

                Comment


                  #9
                  mtthwbrnd,

                  Best course of action would be to inquiry with the author to see if they can direct you to where it needs to be dropped.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    same problem - solved

                    Hi

                    I had the same problem. When I moved the 3rd party DLL to the bin/custom directory first it still did not work. It started working, when I closed NT, started again, compiled my indicator again.

                    regards
                    Andre

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by AttiM, 02-14-2024, 05:20 PM
                    12 responses
                    213 views
                    0 likes
                    Last Post DrakeiJosh  
                    Started by cre8able, 02-11-2023, 05:43 PM
                    3 responses
                    237 views
                    0 likes
                    Last Post rhubear
                    by rhubear
                     
                    Started by frslvr, 04-11-2024, 07:26 AM
                    8 responses
                    117 views
                    1 like
                    Last Post NinjaTrader_BrandonH  
                    Started by stafe, 04-15-2024, 08:34 PM
                    10 responses
                    47 views
                    0 likes
                    Last Post stafe
                    by stafe
                     
                    Started by rocketman7, Today, 09:41 AM
                    3 responses
                    12 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Working...
                    X