Can You Beat the Market?

CSEF · 2015 Mathematics & Software

Overview

Objectives/Goals My objective was to create a trading strategy to achieve a higher rate of return than the overall stock market. I predicted that it is possible to outperform the buy-and-hold investment strategy by using technical analysis based on historical price and volume data to determine buying and selling decisions. I then implemented a genetic algorithm to find successful strategies using combinations of analyses. Methods/Materials The algorithm was trained and evaluated on the SPY index fund, using data from 1995 to 2004 and 2005 to 2014, respectively. Trading decisions were evaluated on a daily basis, and return on investment was used to rank the strategies in each generation. I varied population size, number of generations, and trading cost imposed during training to analyze the algorithm's sensitivity to these parameters. I repeated the experiment ten times to verify the results were reproducible. Results The algorithm was usually able to beat the buy-and-hold strategy, sometimes by a lot, but not every time. The mid-sized population produced the best results. Increasing the number of generations selected increasingly complex strategies, which, beyond some point, did not consistently improve results, especially for small population sizes. Complex strategies that performed spectacularly well (up to 10x return on investment) on the training period did not do well on the evaluation period. Significant trading costs reduced trading frequency and improved performance compared to insignificant costs. Conclusions/Discussion I concluded that it is possible to outperform the buy-and-hold method using technical analysis, at least in the case that there is a significant market downturn, as in the periods analyzed. While genetic algorithms can reliably identify profitable combinations of analyses, overfitting by "getting lucky" on the training data is a significant problem. Increased trading costs somewhat mitigated overfitting by penalizing excessively frequent trading.

Summary statement

I developed a computer program to make automated trading decisions based on analyses of historical price and volume data that achieved superior return (in simulation) than simply buying and holding the SPY index fund.

Help received

Father helped find relevant research, reviewed the code, and scripted the data collection.

Competition history

  • CSEF 2015 Mathematics & Software · Entry S1408

Resources

Related projects

Closest projects by meaning, across every fair and year in the corpus.

Browse more like this

Source: California Science & Engineering Fair public projects

Save projects to your library

Sign in with Google to keep track of projects you find interesting, organized into folders. An account also raises your daily allowance for “Has this been done?”, and lets you create a key for the MCP server with a much higher limit than anonymous use. Browsing stays public.

Continue with Google