Click or drag to resize

Optimizer Attribute

User can optimize a strategy from the Optimizer View. While user declared integer and double properties can be configured from the view itself, any other types can be optimized if the property is decorated with the OptimizerAttribute tag.

Enums can be optimized by simply declaring the Optimizer Attribute in the property. The below code further illustrates it.

private CalculationMode calculationMode = CalculationMode.Price;

[Input]
[Optimizer]
public CalculationMode CalculationMode
{
    get { return calculationMode; }
    set
    {
        calculationMode = value;
        NotifyPropertyChanged("CalculationMode");
    }
}

The above code will evaluate all the enum constants. If you want to optimize specific enum constant(s) then please define the Parameters property appropriately. The below code further illustrates it.

private CalculationMode calculationMode = CalculationMode.Price;

[Input]
[Optimizer(Parameters = new object[] { CalculationMode.Price, CalculationMode.Ticks })]
public CalculationMode CalculationMode
{
    get { return calculationMode; }
    set
    {
        calculationMode = value;
        NotifyPropertyChanged("CalculationMode");
    }
}

For any other types, say a String, can be optimized by decorating the Optimizer tag and defining the parameters array. The same is further illustrated below:

private string inputString = "Value1";

[Input]
[Optimizer(Parameters = new object[] { "Value1", "Value2" })]
public string InputString 
{
    get { return inputString; }
    set
    {
        inputString = value;
        NotifyPropertyChanged("InputString");
    }
}