Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing NT Methods from a Custom Class?

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

    Accessing NT Methods from a Custom Class?

    I'm building an indicator where most of the logic is contained in a custom class. As it is now I need to do all my Print() and draw functions by interfacing with the Indicator class. I was wondering if it possible to access methods and properties from the ninja trader namespace from directly from my class?

    TIA

    #2
    darckeen,

    Unfortunately this is outside the scope of what we can offer support for.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I am not sure I understood completely. Do you like to use Print() from within a helper class of your indicator (for example)? In this case you could deliver an instance of your indicator (this) to your helper class by the constructor and store it to a variable. Then you could apply printing from your helper class as variable.Print("abc").

      Regards
      Ralph

      Comment


        #4
        Ralph. I am also running into this problem. I am porting a GMDH algorithm from Excel VBA to NinjaScripit. The algorithm is being coded in it's own class so it will be portable within NinjaScript. Debugging and some interface issues would be made much easier if I could gain access to some NinjaScript properties and methods from within the GMDH class.

        Not 100% sure what you mean when you say "deliver an instance of your indicator (this) to your helper class ". I will have to read up 'this' and see if I come can arrive at a better understanding of what you are talking about.

        Comment


          #5
          If you want to hand over a global variable to a class instance, I would do that with the constructor. The compiler takes care that you never can forget it . Here is an example:

          Code:
          public class MyInd : Indicator
          {
            private HelperClass helperClass = new HelperClass(this);
          }
           
          public class HelperClass
          {
            private MyInd myInd;
            public HelperClass(MyInd mi)
            {
              myInd = mi;
            }
            private void Print(string str)
            {
              myInd.Print(str);
            }
          }
          Regards
          Ralph

          Comment


            #6
            Thats exactly what i was looking for, Thanks.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by sjsj2732, 03-23-2026, 04:31 AM
            0 responses
            69 views
            0 likes
            Last Post sjsj2732  
            Started by NullPointStrategies, 03-13-2026, 05:17 AM
            0 responses
            312 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            306 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            146 views
            1 like
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            107 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Working...
            X