The WFOResult class extends OptimizationResult with information specific to a single Walk-Forward Optimization interval. A WFOResult can represent either the in-sample optimization result or the corresponding out-of-sample result for an interval. It also stores the date ranges, WFO Efficiency, selected parameter values and performance metrics inherited from OptimizationResult, and optional details about the complete in-sample optimization. WFOResult is also used to represent the optional Pre-Live WFO run.
Inherited from OptimizationResult. Contains the annualized return of the optimization result. WFOOptimizer uses the in-sample and out-of-sample AnnualizedReturn values when calculating WFOEfficiency.
Contains the average number of BarHistory bars available across the symbols used for this WFO result. This is useful for examining how much historical data was actually available within a particular WFO interval.
Contains the StrategyOptimizer that produced the in-sample optimization for this WFO interval. This gives callers access to the complete collection of OptimizationResult instances generated during the in-sample optimization. BaseOptimization is normally associated with an in-sample WFOResult. It can be null when no underlying optimization is available.
Returns the appropriate formatted date range for this result. For an in-sample result, this returns InSampleRange. For an out-of-sample result, this returns OutOfSampleRange.
Returns the ending date appropriate for this result. For an in-sample result:
InSampleEndDate
For an out-of-sample result:
OutOfSampleEndDate
Inherited from OptimizationResult. Contains the Exception message associated with the optimization result if an error occurred. Returns null when no error was recorded.
Returns a descriptive string identifying the type of WFO result. Possible values are:
- In-Sample
- Out-of-Sample
- Pre-Live Pre-Live takes precedence over the normal in-sample/out-of-sample distinction.
The ending date of the in-sample portion of this WFO interval.
Returns the in-sample date range as a formatted string: InSampleStartDate to InSampleEndDate.
The starting date of the in-sample portion of this WFO interval.
The interval number associated with this WFOResult. WFOOptimizer numbers normal intervals starting at 1. If Pre-Live processing is enabled, the Pre-Live result uses:
Intervals + 1
Indicates whether this WFOResult represents an in-sample result. The default value is true. For normal WFO runs:
- true indicates an in-sample optimization result.
- false indicates the corresponding out-of-sample backtest result.
Returns true if this result is not a Pre-Live result. Equivalent to: !IsPreLiveRun
Returns true if this WFOResult represents the optional Pre-Live run. A Pre-Live result is identified by: OutOfSampleStartDate == DateTime.MinValue WFOOptimizer uses a special open-ended out-of-sample date range for Pre-Live results because there is no historical out-of-sample period following the final optimization.
Contains the maximum number of BarHistory bars available for any symbol used in this WFO result.
Inherited from OptimizationResult. Returns the names of the performance metrics associated with the optimization result. These metrics are determined by the ScoreCard used during optimization.
Contains the minimum number of BarHistory bars available for any symbol used in this WFO result.
The ending date of the out-of-sample portion of this WFO interval. For a Pre-Live result this is typically DateTime.MaxValue.
Returns the out-of-sample date range as a formatted string:
OutOfSampleStartDate to OutOfSampleEndDate
The starting date of the out-of-sample portion of this WFO interval. For a Pre-Live result, this is DateTime.MinValue.
Inherited from OptimizationResult. Contains the parameter values represented by this optimization result. For a completed WFO interval, these are the parameter values selected from the in-sample optimization and used for the corresponding out-of-sample test.
Inherited from OptimizationResult. Contains the performance metric values calculated for this result. The available metrics are determined by the ScoreCard used during the optimization.
Inherited from OptimizationResult. Returns the run number associated with the optimization result.
Returns the date used for chronological sorting. For an in-sample result, this returns: InSampleStartDate. For an out-of-sample result, it returns: OutOfSampleStartDate.
Returns the starting date appropriate for this result. For an in-sample result: InSampleStartDate. For an out-of-sample result: OutOfSampleStartDate.
Returns the complete time span represented by the WFO interval. For a normal WFO result, this is calculated as: OutOfSampleEndDate - InSampleStartDate. For a Pre-Live result, it is calculated as: InSampleEndDate - InSampleStartDate.
Returns TimeSpan formatted as a human-readable duration.
Returns a string containing both the in-sample and out-of-sample date ranges. The format is: InSampleStart-InSampleEnd, OutOfSampleStart-OutOfSampleEnd.
Contains the Walk-Forward Optimization Efficiency for this interval. WFOOptimizer calculates this by comparing the annualized return of the out-of-sample run with the annualized return of the corresponding in-sample result. Conceptually: OOS Annualized Return / IS Annualized Return � 100. A value of 100 means the out-of-sample annualized return matched the in-sample annualized return. A value below 100 indicates deterioration out of sample, while a value above 100 indicates stronger out-of-sample performance.
Returns WFOEfficiency formatted to two decimal places for an in-sample result. Returns an empty string for an out-of-sample result. This allows the WFO Efficiency value to be displayed once per interval rather than repeated on both the in-sample and out-of-sample rows.
Restores a WFOResult from a string created by Persist. In addition to the OptimizationResult base-class data, the method restores:
- IntervalNumber
- InSampleStartDate
- InSampleEndDate
- OutOfSampleStartDate
- OutOfSampleEndDate
- WFOEfficiency
- IsInSample
- BaseOptimization results
- AvgBars
- MinBars
- MaxBars If persisted BaseOptimization results are present, WealthLab creates a StrategyOptimizer and restores its Results collection.
Serializes the WFOResult. The serialized value includes the inherited OptimizationResult data as well as the WFO-specific date ranges, interval information, WFO Efficiency, in/out-of-sample state, BaseOptimization results, and bar-count statistics.