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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        52 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        142 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        160 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        96 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