This post is just to share my first algorithm ever and see if anyone has any feedback.

I decided to code out Benjamin Graham's Net Current Asset Value strategy, also known as the Net Net strategy. On a chosen calendar day, the algorithm will find all companies meeting the Net Net criteria and buy an equally weighted portfolio on the next trading day. The algorithm does not include a selling component, so the portfolio will just be liquidated as the insights expire (in this case, after 1000 trading days have passed). Originally I had wanted an algorithm that buys and holds for one year and liquidates at the end of that year, but it was harder to implement than I expected. Shile Wen actually gave me an answer, but the code was a bit too advanced for me. You can find his solution here:

Shile Wen's Solution

My goal was to backtest the period from 1 Apr 1998 to 31 Mar 2020. Since I wasn't quite able to figure out how to liquidate a portfolio at the end of a year, I decided to just do 22 one-year backtests and aggregate my results manually. I know that's a very dumb way to approach the problem, but in this case it was faster for me to do it the dumb way than to learn the smart, proper way.

Thanks to everyone who's helped me so far, especially Arthur Asenheimer and Shile Wen. I will keep at it, and one day I will be able to do this the smart, proper way.