Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trying to reference custom .dll in strategy

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

    Trying to reference custom .dll in strategy

    Hi all. I'm trying to use an assembly I wrote from a strategy, and I'm getting errors. It compiled, but in the log I get an error for each OnBarUpdate: could not load file or assembly 'myAssembly. The system cannot find the file specified.' So... the steps I followed: I added the reference and a reference the assembly is dependent on, added a using declaration, restarted, added one of my types to the code, compiled. Any ideas?

    #2
    Hello,

    Was this a NinjaTrader compiled DLL or was it made outside of NinjaTrader? If developed outside, do you know if it was built using .NET 3.5?

    Where exactly is the assembly located? Are you sure the references point directly to this file?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Hi Matt, I hadn't seen your post but was just coming back to say "solved, I had targeted .net 4." We're in business, thanks for the response.

      Comment


        #4
        Hi,

        I am trying to do the same thing here with the third party DLL log4net.

        I downloaded the source for it from Apache and set the project to point at .NET 3.5 and then built the DLL, with no errors logged.

        I referred my Ninjascript to it and even re-started Ninja, but I am getting

        2013-11-26 14:55:38 Default Error on calling 'OnStartUp' method for indicator 'PermaCodeSR006': Could not load file or assembly 'log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

        This has got to the limit of my knowledge. What else can I do to satisfy .NET here?

        Comment


          #5
          Hello adamus,

          I am not sure since I do not have any experience with this "log4net" assembly.

          Do you mind sharing the "dll" file that you created and the statement in "OnStartup" that you are using that is getting this error?
          JCNinjaTrader Customer Service

          Comment


            #6
            Sure.

            It's attached. Had to zip to make it uploadable.

            In my OnStartUp routine, I only have to have one line of code, any line, referencing the DLL and it causes the error.

            e.g.:

            PatternLayout patternLayout = new PatternLayout();
            Attached Files

            Comment


              #7
              adamus, I would copy the dll to Documents > NinjaTrader 7 > bin > custom and then add a reference to it in NT's editor. Then restart so it could be loaded for for you to use. After that in testing adding namespaces to use works normally, i.e. using log4net.Layout.Pattern;

              Comment


                #8
                Perhaps that helps as well to get further going - http://www.codeproject.com/Articles/...logging-librar

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                668 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                377 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                110 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                575 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                580 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X