Search
  • Chinmay Varshneya

My Journey in Investing: Algorithm


After creating my portfolio, I wanted to create a more tangible method of evaluating whether a stock was worth buying or not. If you’ve read the previous entry, it is easy to see that most of my decision was based on a mix of a gut feeling and some loosely interpreted evidence. In the future, however, when I make decisions, I want a more definitive way to determine whether or not I should make the purchase. Thus, as described before, I set out to make a quantifiable rubric to numerically rate the “worthiness” of a stock.


I had very little idea on how to make an algorithm, however. I decided to just make an initial leap and see where it went. The first version was quite rudimentary, but it a precedent for a series of developments that would improve the algorithm over time. I’m currently working on iteration number three and I will trace each evolution in this article.


Let's start with algorithm version one.


Weighted Average

This was made at the very beginning of my track, back when I used my own lines of reasoning to determine the worthiness of a stock. Thus, as is expected, it lacks financial analytics that I learn to include later on. The model for the algorithm was a weighted average system based on subjective numerical ratings that I gave each category. Of these categories included many of the same factors which I mentioned in my previous entry, such as whether the stock was dipping due to an extraneous event (likely leading to a quick rebound) or whether a product of the company was incredibly popular around me. I also added guidelines such as the rating given by the Goldman Sachs Brokers online as well as if the company was finishing off a strong yearly performance such as Lulu Lemon. After adding a 1–10 rating to each section, I assigned weights to each category depending on how “valuable” I considering each score. Understandably, more opinionated sections were weighed less heavily than a professional recommendation. Once the score was calculated by a simple Google Sheets formula, a range of scores were produced. As an arbitrary rule, I decided that all scores less than five would be “No Buys”, while scores above 5 would be stocks I “should” purchase.


The ironic thing is that this was developed after I made my purchases, so the “results” only ended up serving as guidelines for future decisions. They did, however, point out how poorly thought out the Boeing and Netflix purchases were. I don’t believe that the algorithm provided any novel findings otherwise. I knew going into it, that those stocks were given multiple “sell” recommendations. More likely than not, this conscious bias against the companies and my opinions of the purchase reflected themselves into the final number rating, creating a cyclical self-affirming notion.


Clearly, the above leaves much to be desired, which brings us to algorithm number two. In this one, I aimed to really consolidate the opinions of others rather than insert many of my own into the rating system.


#2

The second version was divided into three sections (originally four, but the fourth found its way into the algorithm’s third iteration). These three being: Analyst Recommendations for the purchase, the timeliness of the purchase, and subjective factors influencing the purchase.


Analyst Recommendations

For the Analyst Recommendations, I took the star ratings of the stocks from 4 organizations/websites: JP Morgan, Morningstar, and TIP Ranks. I had experience reading several articles regarding investing tips from JP Morgan so I trusted their opinions. The same went for Morningstar. On the other hand, I was unfamiliar with TIP Ranks but it claimed to be a service that ranked the quality of various stocks which was exactly was I was looking for in my algorithm. Each star ranking (from 1 to 5) was weighted at 25% and the last subcategory was the overall consensus that these investors had regarding the stock. If it was drawing lots of attention from several analysts then the impression is positive but if it didn’t make any published lists of “ideal purchases,” then the consensus is negative. This information could all be easily determined when looking at the research page of a certain company on one’s Etrade account portal.


The category of timeliness was taken from the first interaction of the algorithm. This was rooted in the basic principle that you should always look to buy low and sell high. A stock that I thought was currently undervalued due to some current event would be a timely purchase.


I used a binary 1–0 system to determine if any of these factors occurred. If there was a short dip in a growing stock like what happened to the S&P 500 during August and October of 2019, then making a purchase would be timely. Additionally, I believe that small blips in the workings of a company would make that purchase timely as well. This was subjective, however. I erroneously believed that Boeing would quickly recover from its 737 Max issues and so would its stocks. I was wrong. Long term potential describes companies that are increasing their market share or are developing technologies that have future potential. For example, Amazon is on the path to domination in virtually every industry, making its future prospects enticing.


Subjective Factors

That concludes my attempt at creating a numerical algorithm.


In the next article, I describe how I shifted from an algorithm based approach to one that used comparative valuations to drive future purchases.

8 views0 comments