There is a large body of literature on the "success" of the application of evolutionary algorithms in general, and the genetic algorithm in particular, to the financial markets.

However, I feel uncomfortable whenever reading this literature. Genetic algorithms can over-fit the existing data. With so many combinations, it is easy to come up with a few rules that work. It may not be robust and it doesn't have a consistent explanation of why this rule works and those rules don't beyond the mere (circular) argument that "it works because the testing shows it works".

What is the current consensus on the application of the genetic algorithm in finance?


I've worked at a hedge fund that allowed GA-derived strategies. For safety, it required that all models be submitted long before production to make sure that they still worked in the backtests. So there could be a delay of up to several months before a model would be allowed to run.

It's also helpful to separate the sample universe; use a random half of the possible stocks for GA analysis and the other half for confirmation backtests.

  • 7
    $\begingroup$ Is that a different process than you would use before trusting any other trading strategy? (If so, it is not clear to me what you gain from making a GA model using data to time t, then testing until t+N before trusting it, versus using data to time t-N, testing from t-N to t, and using it immediately.) $\endgroup$ – Darren Cook Nov 23 '11 at 2:08
  • 4
    $\begingroup$ @DarrenCook one issue I see is that if you test from t-N to t and find it doesn't work well, then you're going to create another model that gets tested on that same time period t-N to t (ad infinitum). That introduces the likelihood of "meta"-overfitting during the model creation process. $\endgroup$ – Chan-Ho Suh Jul 22 '15 at 5:24

I think the biggest problem that genetic algorithms have are overfitting, data snooping bias and that they are black boxes (not so much like Neural Networks but still - it depends on the way they are implemented).

I think they are not used very much. I guess there are a few hedge funds out there that use it but all in all they were hyped and then busted. (But they are still useful for getting a paper accepted ;-)

BTW: There is never a real consensus in finance - everybody tries to outsmart everybody else. This is why it is so interesting. (Or put another way: this is why there are still buyers AND sellers - a real consensus is a crash ;-)

  • 3
    $\begingroup$ Regarding data-snooping, if a GA is implemented correctly, that shouldn't be a concern. Mutation functions are specifically included to randomly search through the problem space, and avoid data snooping. That being said, finding the right mutation levels can be something of an art; and if the mutation levels are too low, then it's as if the function wasn't implemented in the first place. $\endgroup$ – BioinformaticsGal Apr 6 '11 at 16:28
  • 5
    $\begingroup$ @BoinformaticsGal I don't understand how the inclusion of mutation functions allows us to avoid data snooping. After the search, there's a fitness function which makes each generation 'fit' the data ever more. Or am I not understanding you correctly? $\endgroup$ – Vishal Belsare Sep 15 '11 at 18:05

I've applied GA to all sorts of things. I had some success in the deterministic world where a pattern actually existed and I knew that some physical structure existed (seismic analysis, vibration analysis, inventory calcs, etc). After I found a GA model that behaved, the real work started....figuring out why it behaved.

I also generated a lot of GA garbage from financial data that "worked" looking backward, but was worthless looking forward.

Techniques aren't the issue in finance, it's the structure. And, of course, never enough data (useful data).


There's a lot of people here talking about how GAs are empirical, don't have theoretical foundations, are black-boxes, and the like. I beg to differ! There's a whole branch of economics devoted to looking at markets in terms of evolutionary metaphors: Evolutionary Economics!

I highly recommend the Dopfer book, The Evolutionary Foundations of Economics, as an intro. http://www.cambridge.org/gb/knowledge/isbn/item1158033?site_locale=en_GB

If your philosophical view is that the market is basically a giant casino, or game, then a GA is simply a black-box and doesn't have any theoretical foundation. However, if your philosophy is that the market is a survival-of-the-fittest ecology, then GA's have plenty of theoretical foundations, and it's perfectly reasonable to discuss things like corporate speciation, market ecologies, portfolio genomes, trading climates, and the like.

  • $\begingroup$ At short time scales it is more a casino. Like nature, in fact. $\endgroup$ – quant_dev Apr 5 '11 at 20:46
  • $\begingroup$ @quant_dev, the problem with this is that GA-- like any other quantitative methods-- only works with short time scale, if I'm not mistaken. So if stock market is more like a stock market, then GA would be completely useless. $\endgroup$ – Graviton Apr 6 '11 at 8:56
  • 2
    $\begingroup$ @Graviton... There's no inherent reason why one couldn't program a GA to do analysis at longer time spans. The time domain of a GA is measured in generations, not years or days. So, one would simply need to define a population containing individuals whose generations are years or decades long (ie. corporations). There has definitely been some work that approaches defining corporate 'genomes' by their production processes. In such a model, one would optimize for an efficient corporate business model, given a particular market climate. It's not a stock price portfolio model, however. $\endgroup$ – BioinformaticsGal Apr 6 '11 at 15:12

Assuming you avoid data-snooping bias and all the potential pitfalls of using the past to predict the future, trusting genetic algorithms to find the "right" solution pretty much boils down to the same bet you make when you actively manage a portfolio, whether quantitatively or discretionary. If you believe in market efficiency then increasing your transaction costs from active management is illogical. If, however you believe there are structural & psychological patterns or "flaws" to be exploited and the payoff is worth the time and money for researching and implementing a strategy the logical choice is active management.

Running a GA derived strategy is an implicit bet against market efficiency. You're basically saying "I think there are mis-valuations that occur from some reason" (masses of irrational people, mutual funds herding because of mis-aligned incentives, etc.) and "running this GA can sort this mass of data out way quicker than I can."

  • $\begingroup$ manually managing an active portfolio involves using all the information we have and derive a logical conclusion about the market and then execute strategies on it; this is a rational activity. OTOH, using GA is using a black-box tool; we can't explain the result derived from it from any accepted principles. I'm not too sure whether these two are really the same. $\endgroup$ – Graviton Feb 18 '11 at 15:57
  • 4
    $\begingroup$ @Graviton Yes but consider the similarities between GA's and how us humans learn about markets, develop strategies, learn from mistakes, and adapt to changing market conditions. When you research what winning and losing stocks have in common, or what volume and price patterns create good trades, or which model is the most accurate for valuing derivatives what you are doing is data-mining the past in a way. When market conditions change you either trade new strategies or eventually go out of business. If there are exploitable edges in the market then the only difference between you and a GA is $\endgroup$ – Joshua Chance Feb 18 '11 at 16:46
  • $\begingroup$ @Graviton (in a very broad sense) is that you have a narrative, a story to go with your strategy. Us humans risk finding a seemingly recurring pattern and then rationalizing it and creating a narrative. GA's risk the same thing, only their potentially false model doesn't use words, they use math and logic. $\endgroup$ – Joshua Chance Feb 18 '11 at 16:54
  • 2
    $\begingroup$ @Graviton.... as posted below, there are plenty of accepted principles for accepting the results of a GA, if one is using a framework of evolutionary economics. If one is just using monte-carlo style models, then sure, a GA is a black-box, at best. But if your economic perspective is grounded in evolutionary science, the results can be readily interpreted according to principles of ecology and population genetics (i.e. corporate speciation and market ecologies). $\endgroup$ – BioinformaticsGal Apr 5 '11 at 15:53

I just made a Genetic Algorithms calculator you can try at http://www.gregthatcher.com/Stocks/GeneticAlgorithmCalculator.aspx

I'm not a "quant expert" like all of you (I'm just a programmer), but here is what I've found.
1.) If you set the constraints up correctly, the results are amazing. e.g. you can get portfolios that have very high return and low risk. However, it is very important to have conflicting constraints (e.g. a parent can have many children, but the total number of children in a generation cannot go over a certain number) if you want to get good results.

2.) I don't think GA is over-fitting data. Rather, it says "I have too many genes (stocks) to start with, so I'm just going to pick a few to start with, and, except for an occasional mutation, I'll stick with these." Then, over generations, it figures out how to make the best use of what it started with, creating optimum porfolios with the "genes" (a.k.a) stocks it started with (plus a few mutations). Kind of like a builder at Home Depot. Home Depot has lots of tools, but the builder only picks a few to start.

IMHO, Genetic Algorithms are an incredible tool for solving problems that human brains can't.

  • $\begingroup$ Hi Greg Thatcher, welcome to Quant.SE! This sounds very promising, but did you backtest your strategy? $\endgroup$ – Bob Jansen Jun 9 '15 at 8:28
  • $\begingroup$ The GA calculator looks interesting. Is the portfolio performance you show in-sample or out of sample - i.e. is there an overlap in the data you use for GA and the performance calculation? $\endgroup$ – Felix Jun 9 '15 at 9:16
  • $\begingroup$ I have not yet back-tested this, but I plan to after I fix a few small bugs and add some more features. I am using the same data for both the GA calculation and also the graphs I display; I'm guessing that means I'm "in sample" (I'm still trying to get up to speed on all your nomenclature). If anyone has ideas for other features or other GA applications, please let me know. $\endgroup$ – Greg Thatcher Jun 10 '15 at 20:04
  • $\begingroup$ Hi Bob Jansen, I added a link to https://www.portfoliovisualizer.com for each generated portfolio, so now you can backtest each portfolio yourself. I believe the backtests validate the GA results. In any case, thanks much for the tip. $\endgroup$ – Greg Thatcher Jun 15 '15 at 5:49

if you backtest properly your GA (using only past data to generate the time serie of indicator), then you can trust the result.

But I agree with you that genetic algorithms are purely empirical and thus I don't feel very comfortable using them.

  • $\begingroup$ but backtesting is also problematic for GA because the rules that GA selects are the rules that work very well in backtesting. $\endgroup$ – Graviton Feb 18 '11 at 9:30
  • 4
    $\begingroup$ @Graviton: It is also what we (humans) do when we backtest $\endgroup$ – Zarbouzou Feb 18 '11 at 10:04
  • $\begingroup$ you select your strategy using past data, then you apply it to future data! That way you are absolutely not sure that an optimised GA will perform! It will work only if there is persistence $\endgroup$ – RockScience Feb 18 '11 at 16:29
  • 2
    $\begingroup$ That could be said about so many things in finance and prediction in general $\endgroup$ – Steve Severance Feb 20 '11 at 0:57
  • 1
    $\begingroup$ @Graviton, one would assume that you reserved some out of sample data from your training set. Backtesting the trained model should occur on this out of sample data, not on the data one used to generate the GA. $\endgroup$ – Louis Marascio Sep 8 '11 at 12:38

The late Thomas Cover , (likely the leading "Information Theorist" of his generation), considered "Universal" approaches to things like data compression and portfolio allocations as true genetic algorithms.

Evolution has no parameters to fit or train. Why should true genetic algorithms?

Universal approaches make no assumptions about the underlying distribution of data. They make no attempt to predict the future from patterns or anything else.

The "theoretical" effectiveness of Universal approaches (they present significant implementation challenges see my recent question: Geometry for Universal Portfolios?) follow from them doing what evolution demands. The fastest, smartest, or strongest don't necessarily survive in the next generation. Evolution favors that gene, organism, meme, portfolio, or data compression algorithm positioned to most easily adapt to whatever happens next.

Also, because these approaches make make no assumptions and operate non-parametrically, one can consider all tests, even on all historical data, as out-of-sample.

Certainly they have limitations, Certainly they can't work for every kind a problem we face in our domain, but gee, what an interesting way to think about the things.


Well, the goal of a genetic algo is to find the best solution without going through all the possible scenarios because it would be too long. So of course it is curve fitting, that's the goal!!!

  • $\begingroup$ But there is a significant difference between overfitting the sample (bad) and fitting the population (good). That is why many suggest you cross-validate your algorithm with out-of-sample testing. $\endgroup$ – Joshua Jul 17 '13 at 2:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.