Yes, this is a snapshot of my Interactive Brokers account.
If you are an investor in the stock market, this year has been quite the ride for you. The market plunged 35% within a span of a single month from February to March this year. Shortly after, we saw a V shape recovery in the market straight back to its all time high. This was followed by increased volatility from September onwards as we head towards US elections.
Despite the huge volatility in the stock market, my portfolio has done decently well this year with a return of 42.1% vs the S&P 500 which is up 9.4%. In addition, the portfolio had a significantly lower drawdown of 11%.
Here’s how I did it.
Data Driven Investing
As a DIY investor, I use a data driven approach when it comes to investing. No emotional trading out of fear or greed. No reaction to news headlines. And most certainly, no decisions to trade because I “felt” this stock was going to go up.
All investment decisions to buy or sell a stock are made many months in advance based on my trading rules so I don’t need to scramble when markets get volatile. I hate scrambling. It’s much easier to execute a trading plan in a calm and emotionless manner using trading rules that have an edge in the market.
How do I know my trading rules work? You guessed it. I backtest my investment strategy which gives me the confidence to bet my hard earned money in the stock market. Next I go live with my strategy on PyInvesting which implements my strategy by pulling live prices daily and generating orders for me to trade on my Interactive Brokers account. All I need to do is to open my email and execute the trades.
Moving on, what investment strategy do I use?
I’m a simple guy. I buy stocks that have been going up and I sell stocks that have been going down. It’s called trend following.
Trends exist everywhere. We have fashion trends, social trends, weather trends, heck in this age of technology we even have Google search trends. Similarly, trends exist in the stock market.
Statistics show that when a stock has been going up for a period of 6 to 12 months, it tends to continue going up. There are many behavioral reasons for this effect such as herding where people tend to follow the crowd’s sentiment because the terrible feeling that comes with making a loss are muted by the fact that everyone suffered a loss in their investment as well.
I identify trends using moving averages. A moving average is an average of prices within a window of time (black line). When a stock’s price is above its moving average, it means that the stock is trending upwards. Conversely when its price is below its moving average, the stock is trending downwards.
Apple’s stock price with its 200 day moving average (200MA)
We have fast moving averages (where the look back period is usually less than 50 days) to measure short term trends and slow moving averages (look back period longer than 100 days) to measure long term trends. Longer term trends are more stable and less noisy.
Hence the 200 day moving average (200MA) is where I draw the line in the sand. Any stock that is above its 200 day moving average, I will consider to include in my portfolio. Any stock that is below its 200 day moving average, I will sell if the stock is in my portfolio.
After filtering for stocks in a long term uptrend, I rank the stocks using fundamental analysis. This is done by creating a signal for each stock based on their fundamental data.
I use 3 factors to create my signal.
The first factor is price to earnings (PE ratio) which is a measure of the company’s valuation. The lower the PE ratio, the cheaper the stock relative to its earnings which is great for investors. After all, who doesn’t like a nice discount?
The second factor is the return on equity (ROE) which the company’s net income divided by its shareholder’s equity. ROE is a measure of how efficiently a company is able to use its resources. High quality companies tend to have high ROE.
The third factor is profit growth which is a measure of how quickly a company is able to grow its profits. The value of your stock is highly correlated to the earnings of a company. Companies that are able to grow their earnings quickly tend to produce huge returns on their stock prices.
By combining both technical and fundamental analysis, we are able to filter, rank and select the best stocks to include in our portfolio.
Active Risk Management
The next step is to apply an active risk management system based on market sentiment to protect our portfolio during a crisis.
The main idea here is that we want to take on more risk and hold more stocks when market sentiment is bullish. This is because during a bullish regime, markets tend to reward investors for staying invested.
In contrast, when market sentiment is bearish, we want to take less risk by raising our cash allocation and holding fewer stocks. This is to protect our portfolio from suffering huge drawdowns.
For example, during March this year, my portfolio was almost completely in cash as market sentiment turned bearish. This allowed me to reduce my portfolio’s drawdown to 11% even though the market tanked 35%.
Subsequently, PyInvesting gradually started buying stocks and reducing cash to participate in the V shape market recovery that followed.
If you are interested in how I determine this cash allocation feel free to check out PyInvesting’s fear and greed index.
The final piece of the puzzle is position sizing. I hold at least 30 stocks in my portfolio and equal weight each of them.
Why do I do this? To avoid concentration risk. I don’t have a crystal ball and can’t predict when a stock will tank due to a surprisingly bad earnings release or for the case of Tesla, whether the CEO is going to Tweet.
Because of that, I keep each position small so that my risk of being screwed by any single stock becomes very small.
With 30 stocks, my portfolio sits at the yellow sweet spot in the plot below. I get to reap most of the benefits of diversification where the volatility of the portfolio approaches the volatility of the market. Holding more than 30 stocks has not much additional benefit of reducing my portfolio’s volatility.
In doing so, I’m not betting on any single stock carrying the entire portfolio. I’m betting on investment concepts that on average, a group of stocks with high momentum, low PE ratio, high ROE and high profit growth outperforms the S&P 500.
The naive argument against holding 30 stocks in your portfolio is that no one has enough time to research so many stocks and that people who hold more than 10 stocks in their portfolio do not know what they are doing.
My retort against people who make this argument is that we are not living in the age of the dinosaurs. With the help of technology, it’s not difficult to use a backtesting software like PyInvesting to comb hundreds of companies and select the top 30 stocks with the strongest fundamentals and best technical setups in a matter of seconds.
Putting It All Together
We covered multiple individual steps that contributed towards my overall portfolio strategy. We started with identifying stocks that were in a long term uptrend. Next we ranked these stocks using fundamental analysis. Following which we applied an active risk management system. Finally we did position sizing to reduce concentration risk.
Each step contributed towards the overall performance of my portfolio which outperformed the S&P 500 by over 30% so far this year.
Even though there were many steps involved. Implementing the strategy was a breeze using PyInvesting. I simply filled in a form to specify the details for my backtest and went live with my strategy on the cloud. After that all I did was to execute my trades on Interactive Brokers (IBKR) whenever I received an email from PyInvesting.
If you enjoyed this article and would like to go live with your investment strategy on the cloud, I invite you to check out PyInvesting’s moving average backtest which I used to create my personal investment strategy. I hope that it will be helpful to you in your journey towards financial freedom.
Happy investing, and may the odds be in your favour.
Ivan is the founder of PyInvesting.com. He is passionate about technology and finance and has worked as a software developer at a hedge fund where he was responsible for building the fund's trading system. He hopes that PyInvesting will help investors adopt a data driven approach to investing and support them in their journey towards financial freedom.