When you wake up in the morning, you're taller than when you went to bed. You're probably wealthier, too.

Over more than 25 years, the data shows that investors get richer at night and poorer during the day. It's strange, but it's true. While you sleep, your stocks are earning the bulk of their returns.

A person pulling their hair while looking at two computer monitors showing various charts.

Image source: Getty Images.

Making money at midnight

I was introduced to this odd phenomenon by Bespoke Investments, which publishes research on all kinds of interesting patterns in stock market prices. In their study of the S&P 500, Bespoke found that the worst time to be an investor is when the stock market is open from 9:30 a.m. to 4 p.m. Eastern Time.

The best time to be an investor is when the market is closed.

Honestly, I didn't want to believe it. To think that the markets open only to make us poorer isn't a comfortable thought. Only upon duplicating their research did I become a believer. It really is bad to be an investor when the market is open!

S&P 500 returns at when the market is open, closed, and all the time since 1993.

Data source: Yahoo! Finance. Based on open and closing prices for the SPDR S&P 500 ETF from Jan. 29, 1993 to Oct. 23, 2018.

The chart above shows the puzzling difference in stock returns when the market is open, and when it is closed.

If you only owned stocks from close to open, you'd be one of the best investors alive, outperforming in bull markets, bear markets, and over a period that spans more than 25 years!

If you only owned stocks when the markets were open, though, you would have lagged the market tremendously. You would have lost 20% of your wealth as your portfolio eroded at a rate of approximately 1% per year. 

The agony of average returns

Former Fool columnist Morgan Housel once wrote, "On the way to making serious money, you spend a lot of time losing serious money. It's a reality anyone investing in stocks, no matter what you own, has to face."

He called it the "agony of high returns."

Of course, if you happened to own Amazon.com stock since its IPO, you were more than compensated for the trouble of watching it zig and zag, and at times lose more than 50% of its value from its previous peak. You can only feel so sorry for someone who turned $1,000 into more than $1 million in roughly 21 years.

The real agony is the agony of average returns. If you own an S&P 500 index fund, you'll earn a very average return. But you'll have to suffer watching your stocks quietly rise overnight and plunge loudly during the day. It's an unfortunate reality that when the market is most alive it is most likely eating away at your wealth.

If you tune in to financial television, you'll hear pundits say that stocks are dropping because of trade wars, Fed decisions, or the number of housing starts last month. In reality, stocks may very well be dropping simply because that's what they often do.

No free lunch

In a world where taxes and trading costs do not exist and where your behavior has no impact on the market, you'd be able to buy stocks at the closing bell, sell them at the open the following day, and collect a market-beating return for the trouble.

Of course, in the real world, this strategy would fall apart. Commissions will pile up fast. And even if you could trade for free, your portfolio would quickly grow so large it would move prices, completely eliminating the excess returns promised by a simple backtest.

I'm not suggesting that you should employ this strategy in your own portfolio. Please don't. Instead, I'm suggesting you stop looking at intraday charts.

For the last 25 years, stock price movements between the opening and closing bells each day have been a net negative for stocks. If you watch your stocks move up and down all day, you're subjecting yourself to unnecessary pain, because the real money is made while you're sound asleep.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Jordan Wathen has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Amazon. The Motley Fool has the following options: long December 2018 $271 puts on SPDR S&P 500 and short January 2019 $285 calls on SPDR S&P 500. The Motley Fool has a disclosure policy.