[R-SIG-Finance] Are there genetic algorithm for trading strategy evolution in R?
Worik Stanton
worik.stanton at gmail.com
Thu Mar 8 19:47:20 CET 2012
On 09/03/12 07: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
>
> 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?
Yes. But that is the same as any sort of parameter search.
I had a *brief* look at that paper just now and they seem to be using
monthly returns. So they will have ~240 data points over 20 years.
Ignoring the fact that optimisation 15 years ago may well not be the
same as now (markets may change) that is still not much data once you
embark on parameter optimisation.
To avoid data snooping there is really no replacement for more data, (or
avoid search!)
> 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?
?set.seed
cheers
Worik
> So for out-of-sample real-trading, we are trading a random strategy?
>
> 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?
>
>
>
>
> On Thu, Mar 8, 2012 at 8:25 AM, Zachary Mayer<zach.mayer at gmail.com> 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
>>
>>
>>
>> On Thu, Mar 8, 2012 at 12:43 AM, Sofian Hadiwijaya<reztinpeace at gmail.com>wrote:
>>
>>> how about quantmod library..
>>>
>>> On Wed, Mar 7, 2012 at 10:30 PM, Michael<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 mailing list
>>>> 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 mailing list
>>> 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 mailing list
> 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.
>
--
Foo!
More information about the R-SIG-Finance
mailing list