[R-SIG-Finance] Are there genetic algorithm for trading strategy evolution in R?

Brian G. Peterson brian at braverock.com
Thu Mar 8 15:41:30 CET 2012


On Thu, 2012-03-08 at 09:25 -0500, Zachary Mayer wrote:
> There is the DEoptim<http://cran.r-project.org/web/packages/DEoptim/index.html>library
> in r, which is an excellent library for differential evolution.  If
> you can define your trading strategy in terms of a bunch of parameters to
> adjust and an objective function (i.e. turn it into an optimization
> problem), DEoptim will help you find the minimum (or maximum).
> 
> DEoptim works well on non-differentiable problems with many local minima.
>  Here is an example of using it to solve a portfolio optimization problem:
> http://cran.r-project.org/web/packages/DEoptim/vignettes/DEoptimPortfolioOptimization.pdf

Certainly DEoptim can be used for parameter optimization of a trading
strategy.  Of course focusing on genetic algorithms to the exclusion of
other global optimization algorithms may miss the larger challenges of
optimizing trading system parameters.

I think one of the biggest challenges in this space is the definition of
an objective function to give to the optimizer.  What constitutes
success? (and I'm sure your answer will vary widely from other answers
to this question, not one size fits all).

Another major challenge here is that parameter optimization gets into
two 'hard' optimization problems: mixed integer problems, and
multi-objective optimization.

Most global optimizers use some random/directed selection in continuous
floating point numbers.  Trading system parameters may be integers,
factors, floating point, etc.  This poses some difficulty in fitting the
optimizer's floating point parameters to the trading system.

Also, you may actually have multiple objectives.  Maximize Returns and
minimize risk, subject to some maximum drawdown.  This means that you
need to optimize for all these objectives simultaneously.  In portfolio
problems, this is reasonably well understood, see for example
PortfolioAnalytics on R-Forge.  In trading system optimization, it is
not nearly so clear how to create an appropriate penalized objective for
the optimizer to work on.

Regards,

   - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list