Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Where to store the library .cs files ?

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

    Where to store the library .cs files ?

    If there is library class .cs file in the indicator folder, Ninja will write it's own ninjascript code, and it won't compile.

    Are we supposed to store libraries with custom classes in the Add-on folder ?

    Thanks

    #2
    I keep mine in a Strategies folder and that seems to work.

    Comment


      #3
      You should be able to store a class library in the indicator folder, as long as you're not trying to inherit from Indicator.

      There is no way to avoid the wrapper generation if it inherits from indicator and resides in the indicator folder. If you need to inherit from indicator, you'll need to put the class library in a different folder which does not trigger wrapper generation (such as strategies or add ons)

      Code:
      // if this is in the indicator folder, wrappers will be generated
      public class Class1 : Indicator
      {
      
      }
      
      // this should compile just fine regardless of the location
      public class Class1
      {
      
      }
      MatthewNinjaTrader Product Management

      Comment


        #4
        I tried a lot of times with an NT7 library I copied that contains indicator objects, and couldn't help the wrapper that caused non compilation.
        it creates code like this
        Code:
        namespace NinjaTrader.NinjaScript.Indicators
        {
            public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
            {
                private object[] cacheobject;
                public object object()
                {
                    return object(Input);
                }
        
                public object object(ISeries<double> input)
                {
                    if (cacheobject != null)
                        for (int idx = 0; idx < cacheobject.Length; idx++)
                            if (cacheobject[idx] != null &&  cacheobject[idx].EqualsInput(input))
                                return cacheobject[idx];
                    return CacheIndicator<object>(new object(), input, ref cacheobject);
                }
            }
        }
        but copying the code in a new file worked, so I guess I'll manage this way.

        Comment


          #5
          NinjaTrader _8 and personal DLL

          Hi;
          I want integrate my own DLL file to an indicator in NinjaTrader 8. But NT crashed when I compile my code.

          I tried to do like explained in this tuto: https://futures.io/ninjatrader-progr...ading-how.html, but that didn't work. I tried also to use AddOns section and that didn't resolve the problem.

          I really need your help .
          Attached Files

          Comment


            #6
            Hello,

            Thank you for the question.

            In general creating DLL's outside of NinjaTrader would not be something our support could provide exact instructions for, generally any C# tutorial on using Visual Studio to produce a Class Library (dll) will aid in creating a working DLL.

            Without seeing the code used, it would be hard to say why the error is generated other than I see the word "Dependances" in the error, it may have something to do with a reference of that DLL or resource it requires.

            If you have not yet tried creating a brand new class library with no code, I would suggest starting there. Create a empty Class library project, Give a class name and public method that returns a value like a string or int. Now copy the resulting DLL to the bin/custom folder, reference the DLL, add a using statement and create an instance you have.

            If you still get the same error, It could be one of the references automatically added to the IDE you are using. Visual studio automatically adds references which may or may not be used, most are safe to remove from the project. Again this would be a general C# subject so most online tutorials would be the best source of information.

            In addition, I have included a short video showing the general process of setting up a Class Library project. Also please see the Addon sample visual studio project in the helpguide here: http://ninjatrader.com/support/helpG...t_overview.htm

            Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Brevo, Today, 01:45 AM
            0 responses
            3 views
            0 likes
            Last Post Brevo
            by Brevo
             
            Started by aussugardefender, Today, 01:07 AM
            0 responses
            3 views
            0 likes
            Last Post aussugardefender  
            Started by pvincent, 06-23-2022, 12:53 PM
            14 responses
            239 views
            0 likes
            Last Post Nyman
            by Nyman
             
            Started by TraderG23, 12-08-2023, 07:56 AM
            9 responses
            384 views
            1 like
            Last Post Gavini
            by Gavini
             
            Started by oviejo, Today, 12:28 AM
            0 responses
            6 views
            0 likes
            Last Post oviejo
            by oviejo
             
            Working...
            X