Table of Contents

Class OptimizeAttribute

Namespace
Balsam
Assembly
Balsam.Backtester.dll

An attribute to control optimization variables

[AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)]
public sealed class OptimizeAttribute : Attribute, IEnumerable<double>, IEnumerable
Inheritance
OptimizeAttribute
Implements
Inherited Members
Extension Methods

Constructors

OptimizeAttribute()

Default constructor. Typically one of the other constructors should be used.

public OptimizeAttribute()

OptimizeAttribute(double, double, double, bool, bool, bool)

Initializes a new OptimizeAttribute using the specifed start, stop, step and (optionally) multiply parameters.

public OptimizeAttribute(double start, double stop, double step, bool multiply = false, bool isInt = false, bool includeNaN = false)

Parameters

start double

The starting value

stop double

The ending value

step double

The step value

multiply bool

If true, the current value will be multiplied by 1 + step to get the next value in the sequence; otherwise, it is additive.

isInt bool

True if the parameter is an integer.

includeNaN bool

OptimizeAttribute(params double[])

Initializes a new OptimizeAttribute using an arbitrary sequence of values.

public OptimizeAttribute(params double[] values)

Parameters

values double[]

OptimizeAttribute(int)

Initializes a new OptimizeAttribute with the specified number of iterations. Useful for bootstrapping optimizations.

public OptimizeAttribute(int iterations)

Parameters

iterations int

OptimizeAttribute(string, double, double, double, bool, bool, bool)

Optimizes the specified property using the specified parameters.

public OptimizeAttribute(string propertyName, double start, double stop, double step, bool multiply = false, bool isInt = false, bool includeNaN = false)

Parameters

propertyName string
start double
stop double
step double
multiply bool
isInt bool
includeNaN bool

OptimizeAttribute(string, params double[])

Optimizes the specified property using an arbitrary sequence of values.

public OptimizeAttribute(string propertyName, params double[] values)

Parameters

propertyName string
values double[]

OptimizeAttribute(string, int)

Optimizes the specified property for the specified iterations.

public OptimizeAttribute(string propertyName, int iterations)

Parameters

propertyName string
iterations int

OptimizeAttribute(Type)

Optimizes all values of the specified enum or boolean.

public OptimizeAttribute(Type type)

Parameters

type Type

Properties

IsMultiplicative

Returns true if parameters are incremented using a multiplier.

public bool IsMultiplicative { get; set; }

Property Value

bool

PropertyName

Gets/sets the name of the property that is the optimization target. For use in optimization scenarios where you are unable to decorate the class.

public string PropertyName { get; set; }

Property Value

string

PropertyType

Gets/sets the underlying property type that is the optimization target.

public Type PropertyType { get; set; }

Property Value

Type

Start

Gets the starting value.

public double Start { get; set; }

Property Value

double

Step

Gets the increment.

public double Step { get; set; }

Property Value

double

Stop

Gets the ending value.

public double Stop { get; set; }

Property Value

double

TotalIterations

Gets the total number of iterations.

public int TotalIterations { get; }

Property Value

int

Methods

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<double> GetEnumerator()

Returns

IEnumerator<double>

ToString()

Returns a string representation of this object.

public override string ToString()

Returns

string