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

Could not load file or assembly

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

    Could not load file or assembly

    Hi,

    I am building an indicator that shall use classes from a module developed in Visual Studio 2010 using C#. I've added reference to my module in the script editor and successfully compiled the indicator. But when I add indicator to a chart I don't see indicator plot and NT log shows the following error:
    Error on calling the 'OnBarUpdate' method for indicator 'AZSpectrum' on bar 0: Could not load file or assembly 'AZ.DSP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

    I've changed the compilation target for the module (AZ.DSP) to .NET 2.0 but it did not help. It seems like the compiler finds my module but Ninja Trader can not load it during execution.
    I am using NinjaTrader 6.5.
    Please help me with resolving this issue.

    #2
    CycleArt, please remove the references for the assembly by right-clicking the editor window and selecting references and then delete the reference to the file. Then, you'll also have to remove it from the custom assemblies by going to File -> Utilities -> Remove NinjaScript Assembly.
    AustinNinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_Austin,
      I removed reference to my external module from my custom indicator. As soon as I tried to remove the file from custom assemblies I've got an error: "Remove failed. You have custom NinjaScript files on your PC that have programming errors. These errors must be resolved before removing a NinjaScript assembly"
      This error makes sense since if I remove the reference to my module from the indicator code the compiler won't be able to compile the indicator.
      Again what I am trying to develop is an indicator for NinjaTrader that uses classes from my own module built externally in Visual Studio, using C#, .Net.
      Please help.

      Comment


        #4
        CycleArt, please manually delete the .cs file of your indicator from the My Documents/NinjaTrader 7/bin/custom/indicators and then remove the assembly. At this point you can add back the script without the reference and try again.
        AustinNinjaTrader Customer Service

        Comment


          #5
          I've done that.
          From this point I need to start using my module.
          When I use the following directive
          using MyModule;
          the code won't compile unless I create a reference to the module DLL.
          I add reference and then I get the same error as I had before " Could not load file or assembly".
          When I go to Utilities->Remove NinjaScript Assembly there is no item in the list box.
          My DLL is in my private directory, not under
          My Documents/NinjaTrader 6.5/bin/custom/.
          How can I tell NT 6.5 where the DLL is?

          Comment


            #6
            It seems like I have to have my DLL to be under My Documents/NinjaTrader 6.5/bin/custom/ regardless of what the reference tells to the compiler. At least in this configuration it works.
            Is that the reason?

            Comment


              #7
              CycleArt, that could be the reason why. It would depend on how you've coded up and compiled your .dll and how you use that .dll in your script. Anyways, glad to hear you've got it working now.
              AustinNinjaTrader Customer Service

              Comment


                #8
                I wanted to do exactly the same and I have exactly the same problem you had, even when I put the dll under My Documents/NinjaTrader 7/bin/custom/

                Comment


                  #9
                  josepin,

                  Thanks for the post and welcome to the NinjaTrader forums. Yes, you have it in the right place. You also have to add reference to it from the NinjaScript editor. Right Click > References. After adding the reference, restart NinjaTrader and you should then have access to the dll components.
                  Ryan M.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by zstheorist, Today, 07:52 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post zstheorist  
                  Started by pmachiraju, 11-01-2023, 04:46 AM
                  8 responses
                  149 views
                  0 likes
                  Last Post rehmans
                  by rehmans
                   
                  Started by mattbsea, Today, 05:44 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post mattbsea  
                  Started by RideMe, 04-07-2024, 04:54 PM
                  6 responses
                  33 views
                  0 likes
                  Last Post RideMe
                  by RideMe
                   
                  Started by tkaboris, Today, 05:13 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post tkaboris  
                  Working...
                  X