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

Calling DLL from strategy

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

    #16
    Thanks that is it; I am using VS 2010 and .NET 4

    Comment


      #17
      No problem Scott. I discovered this through trial and error. Unfortunately Ninja Trader doesn't mention this incompatibility issue anywhere. I'm sure there are a lot of 2010 users out there who are going to run into this sooner or later. Hopefully the support team knows about it now. It would be a good idea to mention it in the release notes.

      Comment


        #18
        brucieW, have you found any way around this? I still have VS2008 installed but with the exception of the compact framework, everything looks to be .NET 4.0.

        I have other projects going on so I can't just roll back to an earlier .NET; yikes. I really want this stuff in a dll and not methods in NT itself.

        Comment


          #19
          Scott, I believe you should be able to set the target versions in your advanced compiler settings for VS.
          BertrandNinjaTrader Customer Service

          Comment


            #20
            Bertrand, thanks, I don't usually have to do that but now that I think about it, that will work.

            Comment


              #21
              What I did was create a control library (DLL) project that targeted .NET 3.5 which I call from Ninja Trader. This library calls a service that still uses .NET 4 code. There is no way around this (until they make a release that can handle .NET 4.0). You have to make sure that this 3.5 library does not indirectly reference any other .NET 4 libraries. A real pain.

              Comment


                #22
                same pb

                hi,

                I have the same problem ... turning to 3.5, restarting, etc. did not change anything ...

                Any idea ?

                OS = win7 sp1, 64bits, .NET 3.5

                thanks,

                Fab

                Comment


                  #23
                  still the problem

                  Hi,

                  I have still this problem after a lot of checks based on the previous messages.

                  I tryied with a dll containing a very simple class :


                  namespace ClassLibrary1
                  {
                  public class Class1
                  {
                  public static int foo()
                  {
                  return 123456;
                  }
                  }
                  }



                  And in my strategy :



                  protected override void OnStartUp()
                  {
                  Log("read:"+ ClassLibrary1.Class1.toto(), LogLevel.Error);
                  }



                  Compile : ok
                  Runtime : can't find dll ...

                  Any idea?

                  Thanks

                  Fab

                  Comment


                    #24
                    Fab, have you added the reference by right-clicking the editor window and selecting references?
                    AustinNinjaTrader Customer Service

                    Comment


                      #25
                      NT will only work with 3.5 libraries, have you checked the properties of the DLL?

                      Comment


                        #26
                        Originally posted by brucieW View Post
                        NT will only work with 3.5 libraries, have you checked the properties of the DLL?
                        Now it is working !

                        So the procedure for the ones which will have this problem :

                        1 - develop your dll, en c#, .NET 3.5, 64 bits if you intend to use NT 64bits
                        2 - copy the dll into <home>/nt7/bin/custom
                        3 - in the code interface of the stratgy, right-click, select "add reference" and select <home>/nt7/bin/custom/mydll.dll you copied at step 2
                        4 - restart ninja
                        5 - use your dll into the code of the strat
                        6 - test, should work

                        Comment


                          #27
                          Has anyone come up with a work around and/or solution for running .dll files that are built with .net 4.0?
                          Last edited by d.allen101; 12-09-2011, 05:52 PM.

                          Comment


                            #28
                            Will only work with 3.5

                            NT will only link to 3.5 DLLs, pain in the bum. Until NT rebuild using 4.0, you won't get it working.

                            Comment


                              #29
                              hey bruce, i was reading in one of your replies where you mentioned something about a "control library" you wrote that targeted .net 3.5 etc...how is that working out? can you give a little detail on that?

                              Comment


                                #30
                                d.allen,
                                I believe bruicieW was writing/compiling the library using .NET 3.5. That would assume you have the source code for the .dll and some ability (such as Visual Studio) to specify targeting the compilation to .NET 3.5. It also would mean that the source code wasn't using .NET 4 specific features.

                                VT

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by cre8able, Today, 01:35 PM
                                1 response
                                3 views
                                0 likes
                                Last Post NinjaTrader_Jesse  
                                Started by johnMoss, Yesterday, 12:19 PM
                                4 responses
                                22 views
                                0 likes
                                Last Post johnMoss  
                                Started by martin70, Today, 04:06 AM
                                6 responses
                                15 views
                                0 likes
                                Last Post martin70  
                                Started by morleyc, Today, 11:37 AM
                                3 responses
                                12 views
                                0 likes
                                Last Post NinjaTrader_Jesse  
                                Started by Uregon, Today, 12:55 PM
                                1 response
                                4 views
                                0 likes
                                Last Post NinjaTrader_Gaby  
                                Working...
                                X