Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple classes within strategy

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

    #16
    Unfortunately we only support the inheritance model which in enforced by the strategy wizard. In addition I suggest to not use the strategy name "Trade" to avoid confusion.

    Anything outside that scope would be beyond what we are able to provide support for. It may or may not work. In any case you would need to try on your own.

    Comment


      #17
      Dierk,

      I want to personally thank you for this very informative reply. Particularly your closing line.

      A sincere thank you,




      Originally posted by NinjaTrader_Dierk View Post
      Unfortunately we only support the inheritance model which in enforced by the strategy wizard. In addition I suggest to not use the strategy name "Trade" to avoid confusion.

      Anything outside that scope would be beyond what we are able to provide support for. It may or may not work. In any case you would need to try on your own.

      Comment


        #18
        Sefstrat,

        I have been employing this technique to centralize code and I found that setting up a base class using this type of a template was very efficient.

        One thing to remember is that in classes that inherit from the base, you have to do the following in your constructor.


        public class MyClass : MyBaseClass
        {

        public MyClass(Strategy s) : base(s)
        {
        // put your initilizing code in here.
        }

        }

        Originally posted by sefstrat View Post
        Yeah Trade class should not inherit from strategy for what you are trying to do.

        Pass your strategy into Trade constructor if you need to access Strategy members.

        ie

        public class Trade
        {
        Strategy s;

        public Trade(Strategy strat) { s = strat; }

        .....
        }


        then inside your strategy:

        Trade t = new Trade(this);

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X