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

Using custom C# classes problem

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

    Using custom C# classes problem

    I have external C# classes which I referenced from my NT indicator.

    In NinjaScript Editor, I reference the DLL library and it compiles fine.

    I set up a test script, where I have two print statements. One in the Initialize and one in the OnBarUpdate function.

    Everything works fine...except when I include my custom class with the statement

    new CustomClass();
    Even though things compile fine, when I run the indicator, I only see the Print statement from the Initialize function.

    Seems that some errors are happening even though nothing is being reported.

    #2
    clam61,

    This is a bit outside the scope of what we can offer support for, but have you added your DLL as a reference to your NinjaScript assembly? Right click on the NinjaScript Editor -> add reference.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Yes this is how I can get it to compile. Otherwise it wont compile.

      I was under the impression that NT could use external DLLs, I guess it can't?

      How then do I write utility classes and functions for NT?

      Originally posted by NinjaTrader_Josh View Post
      clam61,

      This is a bit outside the scope of what we can offer support for, but have you added your DLL as a reference to your NinjaScript assembly? Right click on the NinjaScript Editor -> add reference.

      Comment


        #4
        clam61,

        You can, but this is much more advanced programming than what we can offer support for.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          clam61,

          You can, but this is much more advanced programming than what we can offer support for.

          i understand you cannot sit here and debug with me...but since this is an advertised feature of your platform can you at least point me in the right direction? a tutorial? maybe i am missing something?

          Comment


            #6
            clam61,

            I could not point you in any direction since I have no idea what errors you are running into. I recommend you check the Control Center logs for errors.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              actually that helped a lot! i just installed NT right now. it says that it cannot load my assembly...however I did reference it from NT Script editor.

              Where else do I need to reference the assembly?

              Comment


                #8
                Originally posted by clam61 View Post
                actually that helped a lot! i just installed NT right now. it says that it cannot load my assembly...however I did reference it from NT Script editor.

                Where else do I need to reference the assembly?
                did you try to drop your assembly into my documents\ninjatrader 6.5\bin\custom ?

                Comment


                  #9
                  Have you tried restarting your NinjaTrader after adding the reference?
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    i just did. no change.

                    do the external classes have to be part of a particular namespace or something else?

                    Comment


                      #11
                      clam61,

                      What is the exact error message you were receiving?
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        3/31/2009 11:45:01 AM,Default,Error on calling the 'OnBarUpdate' method for indicator 'MyIndicator' on bar 0: Could not load file or assembly 'TestClasses, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.,

                        Comment


                          #13
                          Originally posted by clam61 View Post
                          3/31/2009 11:45:01 AM,Default,Error on calling the 'OnBarUpdate' method for indicator 'MyIndicator' on bar 0: Could not load file or assembly 'TestClasses, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.,
                          Where is your assembly?

                          Comment


                            #14
                            Unfortunately this is beyond what we could provide support for.

                            However, here is a hint: you either needed to install your assembly in the GAC or put it in the right directory to avoid this error in the logs "The system cannot find the file specified".

                            Comment


                              #15
                              Dierk

                              What is the "right directory"? Where does NT look?

                              how can you get support for this then? if i pay do i get more support?

                              if you have the knowledge this type of support can only help NT gain more popularity.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by trilliantrader, Today, 08:16 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post trilliantrader  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              9 responses
                              174 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by funk10101, Today, 08:14 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post funk10101  
                              Started by adeelshahzad, Today, 03:54 AM
                              1 response
                              13 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by RookieTrader, Today, 07:41 AM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X