Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Chages to Initialize() in 6.0.1000.2

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

    Chages to Initialize() in 6.0.1000.2

    Could I get a little more detailed explaination of how Initialize() is treated differently in the newest release?

    Will hard coded Strategy properties override the dialog box entries now?

    Will Initialize() for EVERY stategy be called when the dialog box opens?

    Json

    #2
    Hi Json,

    - If you open a strategy dialog window and select a strategy, any properties set in the strategy's Initialize() method will be displayed in the dialog
    - This is only true per instance of a strategy dialog window, so if you change the strategy again while the dialog window is open and change back, it will not reload the settings from the Initialize() method
    RayNinjaTrader Customer Service

    Comment


      #3
      Ray,

      Seems default properties are showing in Strategy dialog not those set in Initialize(). When I run this code, dialog shows: myInput0 = 4 not 21

      public class MyCustomStrategy : Strategy
      {
      #region Variables
      // Wizard generated variables
      private int myInput0 = 4; // Default setting for MyInput0
      // User defined variables (add any user defined variables below)
      #endregion

      /// <summary>
      /// This method is used to configure the strategy and is called once before any strategy method is called.
      /// </summary>
      protected override void Initialize()
      {
      CalculateOnBarClose = true;
      myInput0 = 21;

      }

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate()
      {
      }

      #region Properties
      [Description("")]
      [Category("Parameters")]
      public int MyInput0
      {
      get { return myInput0; }
      set { myInput0 = Math.Max(1, value); }
      }
      #endregion
      }

      Comment


        #4
        That's because you are setting the variable and not the property.

        Try

        MyInput0 = 21;
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        599 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        344 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        558 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        557 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X