The Random Stock Portfolio – Part 2: Short Term Edges

In this post, I would like to explore how short term edges can be applied to the random stock portfolio. Many short term edges try to capitalize on buying an oversold security just before it springs back up, you can add more filters to get better quality stocks and less volatility but I will try  to keep the tests as simple as possible.

Note that in the first post the starting capital was 10,000$ for all simulations and the commission cost was 5$. When trading this small with a 5$ transaction cost, short term edges are really hard to realize so I have upped the starting capital and doubled the commission which is in-line with what my broker is charging me. Never forget the costs associated to all transactions when testing a system!

We will start our first simulation run with a starting capital of 100,000$, for the duration of the simulation we randomly buy 10 stocks and sell them 5 days later then we do it again until the simulation is done. The commission per transaction will be set to 10$.

Here are the performance results for 100 portfolios from 1994 to 2014:

Buy Random Sell After 5 days.20140422T215958

This looks pretty random,  about half will have positive returns but nothing really impressive, this is will be our reference data.

Buy low, sell 5 days later

Now let’s try our first short term edge, what if, instead of buying stocks randomly, we buy any 10 stocks when they reach their lowest price in 7 days? That is, only buy stocks whose current price is lower than all previous 7 days and sell them 5 days later:

Buy On 7 days low, Sell after 5 days.20140422T220548

The median compound annual growth rate for our run of 100 portfolios is 35%! And the minimum growth rate is more than 26%! Of course the draw-downs are big but it does demonstrate the effectiveness of that short term edge. Or does it?

Postdictive error

The previous simulation does something wrong, if the price is the lowest in 7 days it buys the stock, see anything wrong here? We buy the stock at the closing price AFTER the markets are closed, this called a postdictive error. I still think the edge is somewhat valid if you consider that most of the time, the closing price is pretty close to the price, say, 10 minutes before the market close, so you could theoretically run your system 10 minutes before the market close and have time to execute the orders. I unfortunately do not have the data to test this assumption. So lets try to fix our error by buying the stock the next day at the close price:

Buy On 7 days low, Sell after 5 days.BUY_NEXTCLOSE.SELL_NEXTCLOSE.20140424T231346

There is still a small edge but it’s not as striking as the first one, moving the order execution a day later had a very noticeable negative effect.  What if we only bought at the next day’s close IF the next day open is down in order to capitalize the pullback and buy at the lowest price? :

Buy On 7 days low, Sell after 5 days.BUY_NEXTCLOSEIFOPENDOWN.SELL_NEXTCLOSE.20140424T231713
Much better! We still don’t have the same edge as when buying but even the lowest performing portfolio made 8% annual growth rate, not bad for randomly selected stocks filtered by a simple oversold signal.

Another idea is to add a Moving Average filter, same test as before but we buy only stocks at their lowest 7 days when the stock price is above their 100 MA:

Buy On 7 days low, Sell after 5 days on MA(100) uptrend.BUY_NEXTCLOSEIFOPENDOWN.SELL_NEXTCLOSE.20140425T222707Again, we improve significantly our result by considering another simple filter before buying the stock.


Another oversold indicator is the Relative Strength Index with an aggressive value of 2, buy when the RSI is oversold with a value below 15 and sell when it’s overbought with a value of 85, like the last test, we only bought at the next day’s close IF the next day open is down when the price is above the 100 MA :

Buy when RSI(2) below15, Sell after RSI(2) above85  on MA(100) uptrend.BUY_NEXTCLOSEIFOPENDOWN.SELL_NEXTCLOSE.20140425T233639There are many more short term edges that are worth studying, I hope you found the ones presented here interesting. I’m always looking for new edges to test so let me know if you have any to share!

In the next part of the series “The Random Stock Portfolio” I’ll try to look at the performance of longer term edges, stay tuned!









This entry was posted in learning. Bookmark the permalink.