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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      59 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      143 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      161 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      97 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X