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.
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.
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.