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

Executes optimization runs for Optimizers. Optimizer extensions call the ExecuteOptimizationRun method to execute individual optimization runs, and Optimization Visualizers access the Results to represent optimization performance results.

Base Class Members
BacktestSettings
public BacktestSettings BacktestSettings

Returns the backtest settings (instance of the BacktestSettings class) being 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) selected for the optimization.


OptimizerHost
public IOptimizerHost OptimizerHost

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


PositionSize
public PositionSize PositionSize

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


ReportEstimatedCompletion
public void ReportEstimatedCompletion(double value)

Allows an Optimizer to report its estimated completion percentage to the host. The value parameter should be between 0 and 100.


ScoreCard
public ScoreCardBase ScoreCard

Returns the instance of the ScoreCard selected for the optimization.


SymbolData
public List<BarHistory> SymbolData

Returns a List of BarHistory instances containing the historical data being used for the optimization.



Members
CompileUniqueParameterValues
public void CompileUniqueParameterValues(ParameterList pl)

Compiles the unique parameter values that were actually used during the optimization and assigns them to the OptimizedValues property of each Parameter in the supplied pl ParameterList. This is useful for Optimizers that do not necessarily test every possible value represented by a Parameter's MinValue, MaxValue, and StepValue.


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. Returns an instance of the OptimizationResult class containing the performance metrics and results of the run. Optimizer extensions normally only need to supply pl. The optional bmBacktester and addToResults parameters are used internally by WealthLab and can normally be ignored. If a run using the same parameter values has already been completed, WealthLab can return the previously calculated OptimizationResult instead of executing the backtest again.


GeneratesResultsOutsideStepBoundary
public bool GeneratesResultsOutsideStepBoundary

Returns true if the Optimizer generated parameter values that fall outside the discrete values represented by the Parameters' MinValue, MaxValue, and StepValue settings. WealthLab determines this by examining up to the first 100 optimization results.


GetUniqueValues
public List<double> GetUniqueValues(int idx)

Returns a sorted List of the unique parameter values actually used during the optimization for the Parameter at index idx. Since many Optimizers are not exhaustive, the returned values can be a subset of the possible values represented by the Parameter's MinValue, MaxValue, and StepValue properties.


Initialize
public void Initialize()

Initializes the StrategyOptimizer for a new optimization operation by clearing its internally recorded completed runs.


InWFO
public bool InWFO

Returns true if this StrategyOptimizer is currently being used as part of a Walk-Forward Optimization (WFO).


OptimizationHost
public IOptimizationHost OptimizationHost

Returns the IOptimizationHost instance hosting this StrategyOptimizer.


Results
public OptimizationResultList Results

Returns an instance of the OptimizationResultList class containing all recorded optimization runs. Each item in the list is an instance of the OptimizationResult class and contains the parameter values and performance results for one optimization run. Assigning a previously saved OptimizationResultList to this property also rebuilds the StrategyOptimizer's internal record of completed runs.


RunComplete
public OptimizationRunComplete RunComplete

An optional delegate that is called whenever an optimization run completes. The delegate receives the completed OptimizationResult along with the estimated percentage of the overall optimization that has been completed.