WalkForwardOptimizer
StockSharp.Algo.Strategies.Optimization
Walk-forward optimization: the parameters are searched on one stretch of history and the best of them tested on the stretch after it, window by window, so every out-of-sample result comes from values chosen without seeing it.
コンストラクター
WalkForwardOptimizer
public WalkForwardOptimizer(BruteForceOptimizer optimizer)
walkForwardOptimizer = WalkForwardOptimizer(optimizer)
Walk-forward optimization: the parameters are searched on one stretch of history and the best of them tested on the stretch after it, window by window, so every out-of-sample result comes from values chosen without seeing it.
- optimizer
- The search run on each in-sample stretch, and the runner of each out-of-sample one.
メソッド
RunAsync
public IAsyncEnumerable<WalkForwardStep> RunAsync(Strategy strategy, IStrategyParam[] parameters, IEnumerable<WalkForwardWindow> windows, Func<Strategy, decimal> fitness, CancellationToken cancellationToken)
result = walkForwardOptimizer.RunAsync(strategy, parameters, windows, fitness, cancellationToken)
Runs the windows in order.
- strategy
- The strategy whose copies are run.
- parameters
- The parameters to search, with their optimization ranges.
- windows
- The windows to run.
- fitness
- Scores a strategy after its in-sample run; the highest score is chosen.
- cancellationToken
- CancellationToken
戻り値: One step per window that had anything to choose from.