PDA

View Full Version : Chages to Initialize() in 6.0.1000.2


Json
05-20-2007, 04:43 PM
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

NinjaTrader_Ray
05-20-2007, 05:40 PM
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

Json
05-21-2007, 07:01 AM
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
}

NinjaTrader_Ray
05-21-2007, 07:42 PM
That's because you are setting the variable and not the property.

Try

MyInput0 = 21;