Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Derive from Strategy Class

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

    Derive from Strategy Class

    Hi,

    Is it possible to create a class, derived from the Strategy class and use it for all the customer strategies?

    Let's say I have a common Property I would like to use in all the strategies, but I don't want to declare it each and every time.
    Example:

    Code:
    public class myBaseStrategy: Strategy {
            protected int _stopFactor1;
    
            [Description("First Stop Factor")]
            [GridCategory("Parameters")]
            public int StopFactor1   {
                get { return _stopFactor1; }
                set { _stopFactor1 = Math.Max(1, value); }
            }
    }
    
    public class myCustomStrategy: myBaseStrategy {
            protected override void OnBarUpdate()    {
                        
                if (StopFactor1>1) do this and that...
           }
    }
    If this is possible, where do I create this class to be available to all custom strategies?

    Thanks.

    #2
    gogetit, this is unfortunately not supported - methods could be shared if you put them in the UserDefinedMethods.cs in the strategies section - http://www.ninjatrader-support.com/H...verview45.html

    Comment


      #3
      Okay, that's something. Do I need to compile the strategy every time I make a change in that file?

      Comment


        #4
        Yes, every change needs to be compiled in all scripts - they all are hosted by the same assembly for highest performant runtime use.

        Comment

        Latest Posts

        Collapse

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