Investing with the Moon

Posts Tagged ‘algo’

About buying new all time highs

Posted by Danny on October 25, 2017

The mood on US stock markets is as bullish as I have seen it in a long time. That doesn’t mean this is about to change anytime soon. Just like a very bearish mood can continue for years, optimism can also go on longer than most investors expect.
Today I spotted an interesting question on Stocktwits:

“Psychological question for the top callers/hardcore bears: What if this is the lowest price you will ever be able to buy?”

The question suggests that some market participants are becoming worried about missing the next great bull run. But that’s not the reason I am picking up this question. I actually became curious about the odds that stocks will never become this “cheap” again? What happens if you buy new all time highs in major indexes like S&P 500 or Dow Industrials?

To find an answer I took the daily Dow Industrials average starting from year 1900 and checked out how many new all time highs were never revisited again later on. To do this in a fair way I decided to give any new ATH at least 5 days breathing space. If the market ever traded below the ATH after that 5 day window then it would have been better to wait and buy cheaper later on.

The results are quite interesting. As of yesterday October 24, 2017 the Dow has made a new ATH 1382 times. Only 66 of those new ATH have never been revisited so far outside the 5 day space I give them. So basically, if you buy Dow at new ATH levels then you have a little less than 5% chance that you will “never” be able to buy that cheap again. The chance that you will be able to buy cheaper at some point in the future is thus more then 95%. But, some of the more recent ATH that have been set since late 2016 could easily be revisited in a next correction or bear market. We just don’t know yet. So, the real figure could be closer to 3% “NR ATH” (Never revisited all time high). Here is a long term Dow chart where I have marked those NR ATH:


The first thing I found is that all new ATH prior to 1985 have been revisited later on. Between October 1985 and February 1986 there were 16 ATH that still stand as NR (never revisited). It would take a huge crash to the 1386-1639 area to take them out. Between March 1995 and November 1996 there were another 24 ATH that still stand as NR. It would take a drop to 4048 to remove them from the list. In March 2013 we had another 3 NR ATH. A market drop to 14286 would remove them. And since November 2016 we have another batch of new ATH that are still waiting for a revisit, bringing our current total to 66.

This creates the impression that buying on a new ATH is a bad idea but that’s not really the case. Assuming random buying and a fixed 1 year holding period an investor would have enjoyed an average 7.15% annual return in Dow since year 1900. But buying a random new ATH has seen an average 8.45% gain after 1 year. Most new ATH have come in the midst of ongoing long term bull markets, so buying ATH has often shown tidy profits one year later.

If the market almost always revisits previous ATH, then isn’t it better to wait for a bit of a correction to do our buying? Well, the problem is that most of those NR ATH came in the middle of very powerful moves, remember 1985 and 1995? By waiting for a pullback some large 1 year moves would have been missed. I did the test to see what happens if you bought as soon as the market was down 10% from a previous new ATH. Doing that and holding for a year produced only an average 3% gain. Waiting for a larger 20% correction from new ATH did even worse: only 0.1% gain after a year.

There is a way to do better than the average 8.45% annual gain from buying any new ATH. If you had waited for the first new ATH after there had been no ATH for at least a year then you would have enjoyed an average 13.3% gain over the ensuing year. The last such occasion was in July 2016 and it produced a nice 16.5% annual gain.

Bottom line: new ATH levels are almost always revisited later on, often giving investors a chance to buy cheaper in the next weeks/months. But the few times a new ATH was never revisited has led to some of the biggest annual gains, so hoping for a pullback can make you miss out on the best moves. Stock markets have a long history of frustrating investors who are waiting to get in on a pullback. It has happened before and it will happen again.

And what about buying lows? In most markets we cannot study new all time lows. But I took a quick look what to expect if you buy the first 1 year low that comes after an ATH in the Dow. This happens to have a negative expectation. Buying that new 1 year low produced an average 3.5% loss over the next year. So, new one year lows on the heels of ATH have historically been shorting opportunities. If you are not into shorting then just stay out and go fishing for a year. Chances are you will buy much cheaper stocks after that 1 year sabbatical. You would have avoided some of the worst bear markets of the recent century (1907, 1920, 1930, 2000, 2008) by simply resisting the temptation to buy “cheap stocks” on that first 1 year low after an ATH.

With the market still setting new records regularly we are nowhere near new one year lows in the Dow. But that day will come and then you better be very careful. True, the “law of small numbers” applies to this study. The next time may be different. But a lot of trading algos have been trained on the past and some of them will have picked up on this historic tendency. And that may have the effect of repeating the past when those algos start to sell. Be ready for it.

Posted in Market Commentary | Tagged: , | Leave a Comment »

Data science for investors. Do you stand a chance?

Posted by Danny on December 18, 2014

Will algorithmic trading take over the market? How much of a chance do you stand against university trained quants and other math goliaths? Are you too old to keep up or catch up? Is there a way to measure yourself before you commit and maybe lose some or all of your savings in the market? That’s some of the questions that are starting to bother more than a few retail investors. I will try to address them in this article.

As you may have seen on this site, I use my own indicators and algos. Where do they come from? The days that you could easily make money by using standard tools like the RSI or simple moving averages are long gone. Using them is like turning up for a Nascar race with a bullock cart, really… But, you can try to catch up, just like I have tried. I am not a trained a mathematician, I call myself a nexpert, a self-taught nexpert. If I can do it, you can do it. But it will take time, motivation, some basic math skills (or coursera) and a computer.

So, how to get started? Well, why not learn from the best? Would your game of golf improve if you could play some rounds alongside Tiger Woods? Probably. Will your game of poker improve if you play with people who are even worse than you are? Probably not much. The good news is that the internet has made it possible to compete alongside some of the best data scientists in the world. You will not win, but you will learn a lot, things that you can then use in your trading. So, here is the first step: head over to and sign up for a free account. That site organises regular data science contests and sometimes there is big prize money to be won. Many of their contests are sponsored by major companies like GE. There are also starter contests that will teach you the basics of data science. In fact, some of the contests are sponsored by hedge funds who are looking for top talents. So, winning may land you a very well-paying job, designing algos for a hedge fund. Of course, you are not likely to win, because you are up against math professors, university teams and nutcases like me. But you will learn a lot and you will find out where you stand against specialists in the field. I joined kaggle a few years ago and participated in two contests before I took my new skills to play with my own indicators and algos for the stocks market. In the first contest I ranked 98th out of 353 teams. Not too bad. On the second occasion I finished 48th out of 355, so almost in the top 10%. I was surprised to leave college teams behind me, and that gave me confidence that maybe I am not all that bad at this. Here you can find links to the contests I did:

Right now an interesting new contest is starting with $100000 for the winner, and I might jump in if time permits. The challenge is to classify ocean plankton. Now, you may ask what the hell has classifying plankton to do with the stock market? Well, playing the stock market is also a classification problem. If you can find a better way to classify stock setups in categories like “Bullish”, “Bearish” and “Neutral” you are on your way to profits. The skills you learn to classify plankton better can be used to classify stocks as well. Your computer won’t care whether it is classifying plankton or stocks.

The world is full of people complaining about the economy and no good jobs… But half of the day they are wasting away on facebook or playing angry birds on their smart phone (what “smart” phone?). So, why not waste that time on something that may yield some useful new skills? Times have never been better for people with the motivation to learn something new, because the internet makes it free and fun to pick up skills. If I can do it, you can do it. Are you taking advantage?

Good luck, Danny


Posted in Market Commentary | Tagged: , , | 8 Comments »

%d bloggers like this: