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

Patrick Burns patrick at burns-stat.com
Thu Mar 8 20:24:27 CET 2012


Yes, serious chance of doing it poorly
without years of intense work.

On 08/03/2012 19:14, Daniel Cegiełka wrote:
> Let me add my two cents. Old Max Dama blog (mirror):
>
> http://smartdatacollective.com/maxdama/22571/voodoo-spectrum-machine-learning-and-data-sets
>
>
> Optimization is good to examine the sensitivity of the model and the
> selection of appropriate parameters - this is useful. But playing with
> the evolutionary strategy, what you Michael ask, is very risky.
>
> regards,
> Daniel
>
>
>
> 2012/3/8 Patrick Burns <patrick at burns-stat.com
> <mailto:patrick at burns-stat.com>>
>
>     Comments inline.
>
>
>     On 08/03/2012 18:16, Michael wrote:
>
>         Thanks folks!
>
>         After digging further on the Internet, I have the following
>         questions:
>
>         Q1: I read the following article:
>
>         http://cran.r-project.org/web/__packages/DEoptim/vignettes/__DEoptimPortfolioOptimization.__pdf
>         <http://cran.r-project.org/web/packages/DEoptim/vignettes/DEoptimPortfolioOptimization.pdf>
>
>         It seems that there are a bunch of parameters in this optimizer
>         and the
>         results are sensitive to these parameters.
>
>         So there is another layer of optimization with respect to these
>         optimizer
>         parameters.
>
>         Is the "tweaking" of these optimizer parameters data-mining,
>         which will
>         lead to data-snooping bias?
>
>
>     I wouldn't think so, but there might be
>     a way to manage it.
>
>
>
>         Q2: Due to the random nature of the optimizer, each time you run the
>         backtest, you will have different performance.
>
>         What do you do in that case?
>
>
>     That may be a good thing, if you are
>     willing to use it.
>
>     In what I've done on backtesting:
>
>     http://www.portfolioprobe.com/__2010/11/05/backtesting-almost-__wordless/
>     <http://www.portfolioprobe.com/2010/11/05/backtesting-almost-wordless/>
>
>     I show how to assess whether the strategy
>     is better than luck by using random trades.
>
>     The standard thing to assume (as I do in
>     that piece) is that the optimization is
>     noiseless.  But really the optimization
>     depends on a multitude of subtle influences.
>     Even if you always got the exact global
>     optimum, if a variance or expected return
>     were slightly different, you could get a
>     very different path.  The "optimal" path
>     is fuzzy in actuality.
>
>
>
>         So for out-of-sample real-trading, we are trading a random strategy?
>
>
>     Yes.  But the inputs are random so even
>     non-stochastic optimizers give you a
>     random strategy in a sense.
>
>
>
>         Q3: It's pretty easy to understand using Genetic Algorithms to
>         serve as a
>         replacement for regular optimizers;
>
>         but using Genetic Algorithms to evolve trading strategies seem to be
>         different. Anywhere we could find such an example in R?
>
>
>     Yes, that is different.
>
>     In
>     https://stat.ethz.ch/__pipermail/r-sig-finance/__2010q4/007033.html
>     <https://stat.ethz.ch/pipermail/r-sig-finance/2010q4/007033.html>
>     you can find Josh quoting me quoting Lao-Tzu
>     on why you are unlikely to find much useful
>     on that subject.
>
>     Pat
>
>
>
>
>
>
>         On Thu, Mar 8, 2012 at 8:25 AM, Zachary
>         Mayer<zach.mayer at gmail.com <mailto:zach.mayer at gmail.com>>  wrote:
>
>             There is the
>             DEoptim<http://cran.r-project.__org/web/packages/DEoptim/__index.html
>             <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
>             <http://cran.r-project.org/web/packages/DEoptim/vignettes/DEoptimPortfolioOptimization.pdf>
>
>
>
>             On Thu, Mar 8, 2012 at 12:43 AM, Sofian
>             Hadiwijaya<reztinpeace at gmail.__com
>             <mailto:reztinpeace at gmail.com>>wrote:
>
>                 how about quantmod library..
>
>                 On Wed, Mar 7, 2012 at 10:30 PM,
>                 Michael<comtech.usa at gmail.com
>                 <mailto:comtech.usa at gmail.com>>  wrote:
>
>                     Hi all, Good morning, good afternoon and good evening!
>
>                     Could anybody please kindly point me to resources in
>                     R which shows about
>                     how to use Genetic algorithm to evolve trading
>                     strategies?
>
>                     I did a lot search on Google these days and
>                     certainly it's a
>
>                 well-covered
>
>                     and popular topic, but I don't see anywhere in R...
>
>                     Thanks a lot!
>
>                             [[alternative HTML version deleted]]
>
>                     _________________________________________________
>                     R-SIG-Finance at r-project.org
>                     <mailto:R-SIG-Finance at r-project.org> mailing list
>                     https://stat.ethz.ch/mailman/__listinfo/r-sig-finance <https://stat.ethz.ch/mailman/listinfo/r-sig-finance>
>                     -- Subscriber-posting only. If you want to post,
>                     subscribe first.
>                     -- Also note that this is not the r-help list where
>                     general R questions
>                     should go.
>
>
>                         [[alternative HTML version deleted]]
>
>                 _________________________________________________
>                 R-SIG-Finance at r-project.org
>                 <mailto:R-SIG-Finance at r-project.org> mailing list
>                 https://stat.ethz.ch/mailman/__listinfo/r-sig-finance
>                 <https://stat.ethz.ch/mailman/listinfo/r-sig-finance>
>                 -- Subscriber-posting only. If you want to post,
>                 subscribe first.
>                 -- Also note that this is not the r-help list where
>                 general R questions
>                 should go.
>
>
>
>
>                 [[alternative HTML version deleted]]
>
>         _________________________________________________
>         R-SIG-Finance at r-project.org <mailto:R-SIG-Finance at r-project.org>
>         mailing list
>         https://stat.ethz.ch/mailman/__listinfo/r-sig-finance
>         <https://stat.ethz.ch/mailman/listinfo/r-sig-finance>
>         -- Subscriber-posting only. If you want to post, subscribe first.
>         -- Also note that this is not the r-help list where general R
>         questions should go.
>
>
>     --
>     Patrick Burns
>     patrick at burns-stat.com <mailto:patrick at burns-stat.com>
>     http://www.burns-stat.com
>     http://www.portfolioprobe.com/__blog
>     <http://www.portfolioprobe.com/blog>
>     twitter: @portfolioprobe
>
>
>     _________________________________________________
>     R-SIG-Finance at r-project.org <mailto:R-SIG-Finance at r-project.org>
>     mailing list
>     https://stat.ethz.ch/mailman/__listinfo/r-sig-finance
>     <https://stat.ethz.ch/mailman/listinfo/r-sig-finance>
>     -- Subscriber-posting only. If you want to post, subscribe first.
>     -- Also note that this is not the r-help list where general R
>     questions should go.
>
>

-- 
Patrick Burns
patrick at burns-stat.com
http://www.burns-stat.com
http://www.portfolioprobe.com/blog
twitter: @portfolioprobe



More information about the R-SIG-Finance mailing list