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

Ninjascript cannot load external dll

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

    Ninjascript cannot load external dll

    I am an experienced C# developer and recently came across Ninjatrader and thought the concept was cool. So I wrote my indicator logic in a C#.net dll called it through a NinjaScript. Everything compiled fine but when I added the indicator to the chart it cam e up with the error:
    Failed to call method 'Initialize' for indicator 'NinjaTest': Could not load file or assembly 'DotNet35Ninja, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

    VERY DISAPPOINTING for a supposedly mature product! I would be surprised if others haven't tried this rather basic feature of NinjaTrader.


    To replicate in a simple solution, I did the following but got the same problem:



    1) created a dll in .net3.5 with the following code (assembly name DotNet35Ninja):

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace DotNet35Ninja
    {
    public class Class1
    {
    public void Hello()
    {
    Console.WriteLine("Hello from DotNet35Ninja");
    }

    }
    }

    2) created an indicator called NinjaTest and add 2 lines to it:

    using DotNet35Ninja;
    ...

    and in

    protected override void Initialize()
    {

    .....
    Class1 c = new Class1();
    }

    3) put the dll at the right place added assembly to ninja and compiled. everything worked fine. no compile error etc...

    When I add the indicator to a chart, it come sup with the same error as before. This is rather disappointing as you can imagine. Not hard to replicate this for any developer in a few minutes.

    Any comments rather appreciated!

    #2
    Hello newworldguy,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    Was the indicator developed inside of the NinjaScript Editor or was the indicator developed outside of NinjaTrader and added to the .dll?

    When developing indicators outside of NinjaTrader they will still need to be compiled in the NinjaScript Editor as the Editor will automatically generate required program code upon compiling the indicator in NinjaTrader. If you choose to develop custom indicators outside of the NinjaScript Editor environment, please ensure that you use the NinjaScript Editor to compile.

    Comment


      #3
      Indicator was developed inside NinjaScript Editor and compiled inside NinjaScript editor. Sorry if that was not clear in my original post. It only links to a custom assembly and in fact compiles successfully in the NijaScript Editor / Compiler so definetly sees that assembly at compile time. the error only appears at runtime.

      Comment


        #4
        Hlelo newworldguy,

        Thank you for your posts on this item.

        We are looking into this as it is not expected that a custom .dll would produce this error. As you have seen on Forum post http://www.ninjatrader.com/support/f...ead.php?t=9063 this is unsupported and undocumented so there is no go to answer on this subject. Thank you for your patience.

        Comment


          #5
          Trick is after referencing the new DLL in NinjaTrader restart NinjaTrader so that you are able to use it.

          Keep in mind NInjaTrader will only be able to link to .net 3.5 dll's.

          Let me know if after a restart of NinjaTrader you still run into issues.

          Comment


            #6
            OK Patrick. I understand. Look forward to an answer

            Comment


              #7
              Hello newworldguy,

              Thank you for your response.

              My colleague Brett provided a response on this item, please let us know if this resolves them matter.

              Originally posted by NinjaTrader_Brett View Post
              Trick is after referencing the new DLL in NinjaTrader restart NinjaTrader so that you are able to use it.

              Keep in mind NInjaTrader will only be able to link to .net 3.5 dll's.

              Let me know if after a restart of NinjaTrader you still run into issues.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Rapine Heihei, Today, 08:19 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by Rapine Heihei, Today, 08:25 PM
              0 responses
              6 views
              0 likes
              Last Post Rapine Heihei  
              Started by f.saeidi, Today, 08:01 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by Rapine Heihei, Today, 07:51 PM
              0 responses
              8 views
              0 likes
              Last Post Rapine Heihei  
              Started by frslvr, 04-11-2024, 07:26 AM
              5 responses
              98 views
              1 like
              Last Post caryc123  
              Working...
              X