Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting Min, Max & Increment Values For Use In Strategy Analyzer

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

    Setting Min, Max & Increment Values For Use In Strategy Analyzer

    Hello:

    I have been trying to setup my strategy so that the Min, Max and increment values of a variable are always correct when using Strategy Analyzer. Here is the base code:

    #region Variables
    private int entrylong = 20; // Default EnterLong period
    #endregion

    #region Properties
    [Description(
    "Enter Long Period")]
    [Category(
    "Parameters")]
    public int EntryLong
    {
    get { return entrylong; }
    set { entrylong = Math.Max(1, value); }
    }
    #endregion

    For example, how can I change above code so that the following values for a variable are initially present in Strategy Analyzer:
    min: 1
    max: 21
    increment 2

    Perhaps I need a Math.Min as well to accomplish this.

    Thanks,
    Tony
    Last edited by tonyh; 04-08-2010, 08:48 AM. Reason: left out word

    #2
    Hello tonyh,

    Thank you for your post.

    Unfortunately you cannot set default max, min, and incremement values for optimization. You will have to adjust these for each test you want to run.

    You can set the range of acceptable values for your public properties. You have to nest Math.Max and Math.Min:

    Math.Max(1, Math.Min(21, value));
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan. I was just trying to ensure that the parameters would reset to initial settings should I use different optimization values.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      574 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      332 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X