Search Framework:
StrategyOptimizer
Namespace: WealthLab.Backtest
Parent: OptimizationRunnerBase

Executes optimization runs for Optimizers. Optimizer extensions call the ExecuteOptimizationRun method to execute a run, and Optimization Visualizers access the Results from this class to represent optimization performance results.

Base Class Members
BacktestSettings
public BacktestSettings BacktestSettings

Returns the backtest settings (instance of the BacktestSettings class) that was used for the optimization.


CompiledStrategy
public StrategyBase CompiledStrategy

Returns the instance of the StrategyBase derived class that represents the compiled Strategy being optimized.


OptimizationMethod
public OptimizerBase OptimizationMethod

Returns the Optimizer (instance of an OptimizerBase derived class) that was selected for the optimization.


OptimizerHost
public IOptimizerHost OptimizerHost

Returns an instance of the IOptimizerHost instance that lets an Optimizer communicate back information to its host.


PositionSize
public PositionSize PositionSize

Returns the position size (instance of the PositionSize class) that was used for the optimization.


ReportEstimatedCompletion
public void ReportEstimatedCompletion(double value)

Allows Optimizers to report back their estimated completion percentage. The value parameter should be between 0 and 100.


ScoreCard
public ScoreCardBase ScoreCard

Returns the instance of the ScoreCard that was selected for the optimization.


SymbolData
public List<BarHistory> SymbolData

A List of BarHistory instances that constitutes the historical data being optimized.



Members
ExecuteOptimizationRun
public OptimizationResult ExecuteOptimizationRun(ParameterList pl, Backtester bmBacktester = null, bool addToResults = true)

Executes an optimization run by performing a backtest of the Strategy using the parameter values specified in the pl ParameterList parameter instance. The additional optional parameters can be ignored as they are used internally in WL8 and not applicable to Optimizers. The method returns an instance of the OptimizationResult class which contains the performance metrics and results of the run.


FindMetric
public double FindMetric(string metric, List<double> paramValues)

For the performance metric specified in the metric parameter, searches through the Results and return the value of the metric for the optimization run whose parameter values match the ones passed in the paramValues parameter. If no such metric could be found, returns Double.NaN. This method is typically called by Optimization Visualizers.


GetUniqueValues
public List<double> GetUniqueValues(int idx)

Returns a list of all of the unique parameter values in the Parameter that is contained at index idx in the Strategy's Parameters. Since most Optimizers are not exhaustive in nature, the values returned will usually be less than the potential values returned by enumerating the Parameter instance's MinValue. MaxValue, StepValue properties.


Results
public OptimizationResultList Results

Returns an instance of the OptimizationResultList class (derived from List<OptimizatioResult>) that contains all of the recorded optimization runs that were executed. Each item in the List is an instance of the OptimizationResult class.