The Random Stock Portfolio – Part 1

A few weeks ago I had this idea of building a framework for testing portfolios. These portfolios would buy stocks randomly and I would be able to introduce simple trading rules to them and see their effects on a wide range of securities, for a long period of time. I thought I could post about it the next evening but I was a bit of a fool, this stuff is very interesting and I have only scratched the surface of it, this is the first post of many (I hope) exploring how basic trading rules can affect the random portfolios.

Let’s go back 20 years, and create one hundred portfolios, each portfolio will follow the same rules:

  • Portfolio starting capital is 10000$ and each transaction will cost 5$.
  • Select randomly 10 stocks to buy, each stock must have more than 750000 average daily volume and a minimum stock price of 3$ (I know it’s not totally random but I’m only interested in liquid stocks with decent capitalization at the time they are bought!)
  • The sample includes NYSE and NASDAQ markets from 1994 to 2014.

All images in this post include 3 charts, the top chart contains the combined performance of all the portfolios, the lower left chart shows the distribution of the compounded annual growth rate for all portfolios and the lower left chart include the distribution of the draw downs of each portfolios.

First test, totally (mostly) random: Buy randomly any stock, then every trading day, for each positions, roll a 20 sided dice, if it falls on 1, sell the stock and buy another one randomly (5% chance of selling the stocks every day):

Buy Random Sell 5pct.20140316T200352

More than 81% would have been wiped out (In that context, wiped out means that they went from 10000$ to below 1000$).  Only 10% would have broken even.

What if we just bought 10 stocks randomly in 1994 and never sold them, if a stock we bought is no longer being traded, sell it with the last available price and buy a new one randomly :

Buy Random Sell Never.20140316T200018

More than 50% of the portfolios end up with an annualized return of 8.5%, that means more than half would have seen their 10000$ grow to more than 50000$ in 20 years! Even if there are portfolios having huge draw downs, it does show that “buy and hold” has some merits if you stay invested in ANY stocks. The portfolio with 3.76% annual growth rate is the worse one, slightly doubling its initial 10k investment in 20 years, not bad for randomly selected stocks!

Let’s try to put trailing stops and only sell a stock when the trailing stop is hit, the next 5 images contain the results for 1%, 5%, 8%, 15% and 20% trailing stops on randomly bought stocks:

Buy Random Sell On Trailing 1.00pct.20140318T000215

Buy Random Sell On Trailing 5.00pct.20140318T000719Buy Random Sell On Trailing 8.00pct.20140318T001318

Buy Random Sell On Trailing 15.00pct.20140317T235405Buy Random Sell On Trailing 20.00pct.20140317T235237Many books and traders recommend having a 7% or 8% trailing stop, this test shows that maybe that value is too aggressive,  or at least it cannot be applied to ANY stocks, some volatility values should probably be used to make sure that stocks we take positions in are not too volatile.

Having trailing stops based on a stock percentage value seem to have a negative effect when set to values below 12% and a negligible effect when set above 12%, to the point where I find them a bit useless, if not dangerous.

Let’s try to refine our “sell” strategy and have a stop based on the trailing ATR value of the stock instead of a percentage, if the stock is 10$ with an ATR value of 0.10$, we set our stop at 9.90$, if we sell, we re-buy randomly any stock the same day, every day we adjust our stop to the highest value between the old stop and the new stop generated from today’s ATR value :

Buy Random Sell On Trailing ATR(14) x 1.00.20140316T200716Ouch! That Stop might be too aggressive, I tried many multiple increments and the best value I came up with is a 5 to 8 times the ATR value so for a stock is 10$ with an ATR value of 0.10$, we set our stop at 9.20$ when we want 8 times the ATR value (10$ – 0.10$ *8 = 9.20$) :

Buy Random Sell On Trailing ATR(14) x 8.00.20140319T223309

None of the portfolios have wiped out, all of them broke even, and more than half had annualized returns of more than 9.37%, not bad.  The big 86% draw down was a bit of a let down so I took a look at the actual trades and trailing stop values, using a 8% trailing stop is fine for some stock but for others  it can represent more than the actual stock price! To work around that, I introduced a NATR buying filter which allows for the selection of less volatile stocks. Here are the results when buying only stocks with a NATR value of less than 3%:

Buy Random Sell On Trailing ATR(14) x 8.00 natrMax=3.00pct.20140316T201328

In all runs the NATR value limitation reduced the drawdown significantly with a small negative effect on the total returns.

Stay tuned for part 2 where I’ll try to make the random portfolio even less random by trying different rules for buying and selling as well as some concepts used in my own portfolios, if you have any basic trading ideas you would like to see tested in this framework let me know and I’ll try to add them as well!

Some ideas I would like to try:

  • Buying after consecutive down/up days
  • Buying trending stocks
  • Buying market out-performers
  • Following market wide signals
  • Various common technical signals
This entry was posted in learning. Bookmark the permalink.