I am trying to add a float property to my strategy. Specifically I am
declaring a variable called vProfitTakePercentage that will be added
to my Initialize() method. My main issue is with the "set" in my
public float VProfitTakePercentage property declaration.
set { vProfitTakePercentage = value; }
works fine however when I attempt to optimise the default value,
the variable is fixed at 0.03. I want however a MIN and MAX just like
the other Integers so that when I run the optimiser the best
SetProfitTarget is found.
Here are the main components of the code:
#region Variables
private float vProfitTakePercentage = 0.03f;
#endregion
protected override void Initialize()
{
SetProfitTarget(CalculationMode.Percent, vProfitTakePercentage); // 3%
}
#region Properties
[Description("Profit Take Percentage")]
[Category("Parameters")]
public float VProfitTakePercentage
{
get { return vProfitTakePercentage; }
//set { vProfitTakePercentage = value; } // set { vProfitTakePercentage = Math.Max(1f, value); }
set { vProfitTakePercentage = Math.Min(Math.Max(0,value),1000); } //set { yOffset = Math.Min(Math.Max(0,value),1000); }
}
#endregion
many thanks for any assistance.
Comment