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
Resources
Related projects
CSEF · 2006
An Algorithm for Predicting Future Stock Market Fluctuations by Volatility and Arccosine Analysis
CSEF · 2017
Improving the Rationale for Stock Market Investments to Help Middle Income Households
ISEF · 2018
Game Theory-based Investment Strategy vs. Buy-And-Hold: Which Optimizes Profits?
CSEF · 2005
A Proven Mathematical System for Predicting Future Stock Market Fluctuations
CSEF · 2015
Stock Market + Risk Management = College Paid
CSEF · 2009
Buy Bonds: Investment Algorithm Using an Inverted Linear Yield Curve
ISEF · 2015
Genetic Algorithms for Foreign Exchange Trading
ISEF · 2024
Coding an Algorithmic Day Trading Strategy - Power of 3
Closest projects by meaning, across every fair and year in the corpus.
Browse more like this
Source: California Science & Engineering Fair public projects