15,000%, Really?

So far the capstone project has been one of my favorite classes. I am enjoying it because I very much love the project that I was assigned: Algorithmic Stock Market Trading Strategies for Individual Investors. One of this project’s best aspects is I will be able to take learnings from his project and use them in the future

With respect to the project, our team has reached the point where we are using genetic algorithms to optimize parameters for various stock trading algorithms. I find myself spending as time much reviewing data and thinking about how to tweak parameter ranges as coding. I also find myself staring at the screen as the algorithm spits out results waiting to see the next net profit. And this can occur for far too many hours as it takes the algorithm hours to sort through various combinations of parameters as it works to find the maximum profit with the minimum drawdown

After running multiple optimizations on a few algorithms, I find myself questioning whether this works. Is there really an algorithm that by selecting the right parameters an individual investor will get a better return than simply buying and holding an index fund? I don’t believe anyone can predict the direction of the market with certainty, so why should an algorithm be any better?

The first algorithm tested was a simple MACD algorithm. Investopedia has a good explanation of the MACD. For this test, we set ranges for the momentum indicators and signal line and let the genetic algorithm find the optimal solutions if an investor had been trading the Invesco QQQ using the trading algorithm starting on January 1, 2011 and ending on March 30, 2021. The chart below shows the results, which were underwhelming. The best parameters found by the genetic algorithm returned a net profit of about 225%. As a point of reference, an investor who simply bought into the QQQ around January 1, 2011, and held onto it until March 30, 2021 would have earned a return of 522%. So, not such a good start.

MACD Optimization Results – Trading QQQ from Jan 1, 2011 – Mar 30, 2021

Then we tested a simple algorithm given to us by our advisor. This algorithm was created by a previous capstone group. It was called the momentum algorithm because like the MACD, it attempts to make trading decisions based on short and long momentum using the momentum percent indicator. This one left also left much to be desired. The best return it could muster over a ten year trading period was around a 50% return, worse than even the MACD. At this point, buying an index fund is looking quite good for the small investor.

Our advisor, however, has algorithms that he believes can vastly outperform buy and hold strategies. He shared one of them and turned us loose on it to trade the Invesco TQQQ from January 1, 2011 through December 30, 2022. After some programming missteps, we finally got the optimization algorithm running. And the results? The chart below speaks for itself.

Trading Algorithm Optimization Results – Trading TQQQ from Jan 1, 2011 – Dec 30, 2022

Yes, you are seeing that correctly. The optimization algorithm found parameters that would have resulted in a return approaching 15,000% over the trading period. In comparison, buying and holding the TQQQ starting on January 1, 2011, would have resulted in a gain of about 2,100%. Using this algorithm with the correct parameters over that time period would have netted an investor using it to trade the TQQQ a significant premium over the buy and hold investor.

I am still on the fence about whether this can work for individual investors. I want to run this algorithm over other stocks and different time periods to see if it holds up. And, there is a big difference between actual trading and paper trading on historic numbers. It is, however, intriguing to think about the possibilities of using this or another algorithm to make investing decisions.

WallStreet Bets

If you don’t know what WallStreetBets is about, that is probably for the best. If you do, this isn’t what this post is about. Instead, I am going to reflect on my assigned capstone project: Algorithmic Stock Market Trading Strategies for Individual Investors.

I was very happy when I first learned this was my assigned project. This project was my first choice for a few reasons. First, there was an outside sponsor, which seemed like a good opportunity to work with someone outside the university. Second, I thought it would be fascinating to work on a project with an objective to optimize parameters for a stock trading algorithm with a goal of obtaining better than average results. The project has exceeded my expectations so far.

Our advisor, Chester Ones, is a very interesting person. He has worked on machine learning systems for over 30 years and currently works at Levrum Data Technologies, a company which helps local municipalities more effectively manage their EMS systems. He has also been investing in the stock market for around 40 years, which means he has experienced the crashes in 1987 and 2008 and the dot.com bubble. He has also been working and developing stock trading algorithms for many years. In short, he has a wealth of hard-earned experience and knowledge.

With respect to the project, we have been directed to use QuantConnect Lean, an open-source algorithmic trading engine. This application has a relatively simple to learn command line tool that when installed and run in a docker container allows for local backtesting of trading algorithms. Successful runs are saved on a json file that contains the results of the analysis.

Our project will involve taking combining this QuantConnect tool with a multi-objective optimization algorithm to identify the optimal variables to use with the proposed trading algorithm. Right now, this project seems very challenging but I am excited by the opportunities it presents to learn how to combine different software to create a useful application.

ChatGPT Confession

I have a confession. I used ChatGPT to help create my blog’s name. How did this happen?

Let me go back to the start of creating this blog. When I started the sign-up process, I noticed a list of newly created blogs, including blogs created by classmates in CS 467. Some classmates had used topical names for their blogs. A topical name seemed like a good idea so I decided to do the same. I couldn’t, however, think of a name for my blog. I was stuck.

While having this brain block, I recalled a conversation with my boss on Friday regarding ChatGPT. He had some friends who had been trying it out and told him it was replying with surprising good answers. He decided to try it himself and was also surprised about the general quality of the answers.

During this conversation, we discussed ways ChatGPT could impact our profession. We considered whether this could in the future be used as a reference to look up answers to legal questions. We also discussed the possibility of using the technology to create contracts. The possibilities are kind of interesting when you start thinking about the potential implications of this technology.

So coming back to my blog naming issue, I thought why not see if ChatGPT could suggest a name for me. I started by going to the OpenAI’s ChatGPT website. There, I discovered that I must first create an account. Normally, I don’t like creating a new account because it is just another account name and password to remember. The sign-up process, however, was relatively painless as I could use my Google account to create an account.

Once into the account, I asked ChatGPT what is a good name for a blog. The software returned a surprisingly good answer. ChatGPT suggested that I focus on the topic of the blog, the intended audience, or personal style. It then provided examples of each of these suggestions. For example, it suggested consider a name like “Wanderlust World” for a travel blog. Moreover, this initial response helped me refine my question to be suggest “good names for blog about computer science capstone project.”

In response to this refined question, ChatGPT returned a list of suggested names. The list included the following:

  • “Code to Capstone”
  • “Tech Tales”
  • “CS Capstone Chronicles”
  • “The Final Frontier”
  • “Computing Conclusions”
  • “Innovative Ideas in CS”
  • “Project Paradigms”
  • “The Capstone Corner”
  • “Tech Trek”
  • “Computer Science Capstone Connections”

This list was a good start. There were a few, such as “Code to Capstone” and “Project Paradigms” that I kind of liked. None though screamed out to me “USE IT.”

ChaptGPT, however, has a convenient feature that allows for resubmission of the same request to generate a new answer. I did this four times. ChatGPT generated some repeated suggestions. It especially like suggesting “Tech Trek” and “Capstone Chronicles.” But it also generated new ones. And on the fourth try, I finally saw one that resonated with me: “The Capstone Journey.” I eliminated “The”, and I had the name of my blog: “Capstone Journey.” And thus, this is how I ended with a blog name suggested by ChatGPT

Imposter Syndrome

I have completed 14 computer science classes. All that stands in the way of earning a C.S. degree from Oregon State University is CS 467, the capstone class. I am excited to start this class but also a bit nervous. While I have successfully completed 14 other computer science classes, I question whether I have sufficient coding skills to contribute effectively to a moderately complex project. As I begin scanning potential projects, my anxiety increases. Each project that I open looks beyond my skill level.

I stop my project review. I open Google’s search engine and enter “Imposter Syndrome”. A Wikipedia page is among the search results. On that page, I find the following: “Impostor syndrome, also known as impostor phenomenon or impostorism, is a psychological occurrence in which an individual doubts their skills, talents, or accomplishments and has a persistent internalized fear of being exposed as a fraud.” That sentence pretty much captures how I feel after perusing the capstone projects.

This feeling, however, is not new during my computer science journey. I felt this way the first time I read the specifications for the smallsh assignment in CS 344 Operating Systems. I had similar feelings when I first saw the Wastegram assignment in CS 492 Mobile Software Development. And for a solid week, I debated with myself whether I should drop CS 464 Open Source Software after learning that a contribution had to be submitted to an approved open source project. In each case, however, I successfully completed the assignment by simply taking it one step and day at a time. I trusted that if I put in the time and effort, I could accomplish things that seemed unattainable when first encountered. And I did.

So I go back to the projects page. I begin looking for projects that look interesting. I find one. I read the details about it and check the requirements. The minimum requirement is some experience with python. Okay, I’ve programmed in python. One down, 5 more to go. I repeat this process until I identify six projects that interest me and that I feel qualified to do.

With six projects found, I go to the survey, rank my preferred projects, and submit the survey. I now excitedly await to see which one, if any, I am assigned and who will be my teammates. While all six still seem beyond my reach to do as of today, I trust that if I put in the time and effort, it will all come together in the end.