Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Walk Forward Optimization

Open jaredbroad opened this issue 2 years ago • 4 comments

Desired Behavior

  • Create Walk Forward Optimization API in LEAN.
  • Harness existing parameters and optimization controller technology to implement scheduled optimizations.
  • Use a pluggable source for the optimization provider.
  • In backtesting, run local LEAN instances inside LEAN Foundation, as backtests can take a long time.
  • In live trading, run an APIOptimizationHandler to run the optimization lift in the cloud; to keep live loads light.
  • Use the Scheduled Event System to handle initializing the optimization.

QCAlgorithm.Optimize(DateRule, TimeRule, {Optimization Target | Optimization Target Func<BacktestResults[]>} )

  • Date/Time Rules - When to run WFO / Month Start, Week Start etc.
  • Optimization Target - Select the winning set pf parameters.
  • The result would then set the algorithm parameters set.

Checklist

  • [x] I have completely filled out this template
  • [x] I have confirmed that this issue exists on the current master branch
  • [x] I have confirmed that this is not a duplicate issue by searching issues

jaredbroad avatar Mar 01 '23 20:03 jaredbroad

A simple idea of how I would expect to use this:

image

algo-dude avatar Jun 01 '23 01:06 algo-dude

Parent and Child algorithms to avoid nested optimizations

jaredbroad avatar Aug 04 '23 23:08 jaredbroad

this would be interesting! Please allow to pass an objective function to "score" where one can use the runtime statistics of the backtest and not only point estimates of the score of the backtest.

KlausGlueckert avatar May 05 '24 20:05 KlausGlueckert

Is there a way to run the backtest on the research.ipynb?

I would like to optimize parameters but would need to extract values from the run backtest (objective function). Is it possible to call on the backtest strategy within research Jupyter notebook?

RooFernando avatar Jul 05 '24 01:07 RooFernando