STEM I

This course focuses on scientific research and engineering. During the first part of the year, students conduct independent research projects that incorporate reviewing literature, making conjectures, developing methodology, designing experiments, and communicating findings. Their final projects are presented at a school-wide science fair, with the possibility for advancement to regional, state, and international fairs.

Developing non-machine learning algorithms for determining when to buy and sell on the stock market

Overview

Smaller investors are at a significant disadvantage when investing in the stock market due to their lack of access to advanced algorithms. In order to address this issues in a way that was easy to understand for the individuals that will be using these algorithms, I set out to develop flexible non-machine learning algorithms to help smaller investors in the market.

Abstract

Graphical Abstract

The stock market is a difficult place to survive for smaller investors, with constant competition against far larger entities. A particular issue that many smaller investors struggle with is the lack of access to effective, understandable, and flexible algorithms. In the new age of the stock market where the largest investors have incredibly complex machine learning algorithms to aid their investing, making active investment difficult for minor players. To address this issue, I will be attempting to develop an algorithm geared toward smaller investors that will outperform the basic algorithms available today and give a chance for smaller investors to participate in the market on a more equal footing. Previously, the algorithm designed for smaller investors was buy and hold, which has been shown to be flawed by new research. We will develop algorithms using historical data for testing and attempting different approaches for algorithm development, including utilizing moving averages and the change in price. So far, the focus has been on developing very fundamental algorithms, one of which was able to outperform buy and hold by about 13% over the course of 20 years in initial testing which is an encouraging sign. The goal is to combine these techniques and others to create algorithms that can be better than buy and hold by a statistically significant margin over many stocks, ETFs and funds. By developing this versatile algorithm, we will aid small investors in remaining competitive in today's market.

Graphical Abstract

Research Proposal

Problem Statement

Engineering Goal

This project seeks to address the issues small investors face when attempting to participate in the stock market using algorithmic investing.

The goal of this project is to develop several different, flexible algorithms that compare favorably to buy and hold, and then test for performance to find the most successful algorithm and continue improving it.

Background

Background Infographic

Graphical Backgorund

Procedure

Procedure Infographic

Graphical Procedure
Graphical Results

Figure 1: This is an example of the work of the justma algorithm over the entire timeframe of about 20 years on the Apple stock.

Graphical Results

Figure 2: This is a chart of the performance of the justma algorithm on the entire dataset of stocks, ETFs, and funds that were tested.

Graphical Results

Figure 3: This is a chart of the performance of the ChangeandMA algorithm, the first hybrid develped algorithm, on the entire dataset of stocks, ETFs, and funds that were tested.

Graphical Results

Figure 4: This is a comparison of all the algorithms that were developed which demonstrates their average performance.

Analysis

A very important observation that confirmed that our development method wouldn't lead to overfitting is confirmed by the first two graphs, which demonstrate how an algorithm which performed well on Apple stock didn't perform well on the entire dataset. This is important to note because otherwise it could be said that the fact that the algorithm performs well on apple means it will perform similarly on the entire dataset, which would then imply that overfitting to the Apple stock could be an issue, but this is not the case. The final graph shows that the algorithms that examined only a single feature of the data underperformed significantly when compared to buy and hold. However, the hybrid algorithm created by combining the two best single feature algorithms ended up outperforming buy and hold by a significant margin. Additionally, the third figure which shows the performance of that hybrid algorithm shows that it doesn't appear to have any strong skews in performance toward a particular type of investment or industry, which bodes well for its usability on the market as a whole.

Conclusion

The initial goals of this project were to develop algorithms for small investors which were easy to understand, flexible, and were able to outperform buy and hold. This is a crucial issue now more than ever, as the market has become much more perilous for small investors, with buy and hold no longer as safe of a strategy. To address this issue, I used historical data from some of the highest cap stocks, ETFs and mutual funds to find algorithms that will be able to effectively invest in the market. I used a variety of different features about the price of the stock, importantly avoiding any machine learning in my work and making a single generalizable algorithm. I feel like my my work has demonstrated the validity of my development process and the fact that this algorithm can be applied to the current time period with results that won't suffer due to overfitting. More importantly, I was able to develop an algorithm without using machine learning that was easy to understand and flexible, and which outperformed buy and hold. As much as this project was meant to produce a successful algorithm, it was also meant to show the viability of this kind of algorithm development to encourage others to consider this idea, as well as giving access to a baseline successful algorithm to give small investors an idea of what might work.

References

Ayyildiz, N., & Iskenderoglu, O. (2024). How effective is machine learning in stock market predictions? Heliyon, 10(2). https://doi.org/10.1016/j.heliyon.2024.e24123
Chen, J. (2024). Algorithmic trading: Definition, how it works, pros & cons. Investopedia. https://www.investopedia.com/terms/a/algorithmictrading.asp
Chen, C., Chen, C., & Liu, T. (2020). Investment performance of machine learning: Analysis of S&P 500 Index. International Journal of Economics and Financial Issues, 10(1). https://www.econjournals.com/index.php/ijefi/article/download/8925/pdf/21843
Huang, W., Satoru, G., & Nakamura, M. (2021). Decision-making for stock trading based on trading probability by considering whole market movement. European Journal of Operational Research, 157(1), 227-241. https://doi.org/10.1016/S0377-2217(03)00144-9
Huang, Y., Zhou, C., Cui, K., & Lu, X. (2024). Improving algorithmic trading consistency via human alignment and imitation learning. Expert Systems with Applications, 253, 124350. https://doi.org/10.1016/j.eswa.2024.124350
Kuo, S.-Y., & Chou, Y.-H. (2021). Building intelligent moving average-based stock trading system using metaheuristic algorithms. IEEE Access, 9, 140383-140396. https://doi.org/10.1109/ACCESS.2021.3119041
Ling, F., Ng, D., & Muhamad, R. (2014). An empirical re-investigation on the 'buy-and-hold strategy' in four Asian markets: A 20 years' study. World Applied Sciences Journal, 30(30). https://doi.org/10.5829/idosi.wasj.2014.30.icmrp.30
Picardo, E. (2024). Investing explained: Types of investments and how to get started. Investopedia. https://www.investopedia.com/terms/i/investing.asp
Qin, L. (2018). Game theory-based investment strategy vs. buy-and-hold: Which optimizes profits? ISEF Abstracts. https://abstracts.societyforscience.org/Home/FullAbstract?ISEFYears=0%2C&Category=Any%20Category&Finalist=Qin&AllAbstracts=True&FairCountry=Any%20Country&FairState=Any%20State&ProjectId=16428
Saez, E., & Zucman, G. (2020). The rise of income and wealth inequality in America: Evidence from distributional macroeconomic accounts. Journal of Economic Perspectives, 34(4), 3-26. https://doi.org/10.1257/jep.34.4.3
Sakhare, A., Mhaskar, N., Mishra, V., & Chavan, M. (2021). Algorithmic trading for a buy-sell platform: Study and comparison. ITM Web of Conferences, 40, 03020. https://doi.org/10.1051/itmconf/20214003020
Sanderson, R., & Lumpkin-Sowers, N. (2018). Buy and hold in the new age of stock market volatility: A story about ETFs. International Journal of Financial Studies, 6(3). https://doi.org/10.3390/ijfs6030079
Sikalo, M., Arnaut-Berilo, A., & Zaimovic, A. (2022). Efficient asset allocation: Application of game theory-based model for superior performance. International Journal of Financial Studies, 10(1), 20. https://doi.org/10.3390/ijfs10010020
Sobolev, D., Chan, B., & Harvey, N. (2017). Buy, sell, or hold? A sense-making account of factors influencing trading decisions. Cogent Economics & Finance, 5. https://doi.org/10.1080/23322039.2017.1295618
Taylor, B. (2024). 5 key investment strategies to learn before trading. Investopedia. https://www.investopedia.com/investing/investing-strategies/

Poster

Poster