On paper, investing is simple. Just look for a few great businesses, or, if you don't have time to research individual stocks, buy index funds. Then hold on for the long term as the power of compound growth works its magic.

Of course, things aren't always so simple. As we saw last year, the market can be incredibly unpredictable, which can create both dangers and opportunities for investors. At the same time, your financial needs will change throughout your life. In any given year, your unusual near-term expenses might include relocating, putting a down payment on a home, medical bills, or college tuition, among other things.

Last week, we saw some stock market volatility as long-term bond yields ticked upward, putting pressure on corporate valuations, especially among expensive growth stocks. With the major stock indexes near their all-time highs and several valuation indicators at historically high levels, is now the time to ditch stocks and stash cash in your brokerage account?

A young woman looks into the camera as she stashes cash under a mattress.

Image source: Getty Images.

Current fears

It's not crazy to wonder if you ought to be pulling some cash out of equities. The stock market is up by 24.4% over the past year, which counts from the period just before the COVID-19 crash. From the March 2020 bottom, the S&P 500 is up by a stunning 78.4%, and many technology stocks have soared by multiples of that. Rampant speculation has also taken hold of certain corners of the market, from SPACs to the beaten-down meme stocks being pumped up on Reddit's message boards. 

That has left things quite frothy, and some gauges of the stock market's valuation are flashing yellow right now -- if not blinking red. 

The Schiller P/E and Buffett's favorite indicators are worrying

The Schiller P/E ratio looks at the market as a multiple of its inflation-adjusted earnings over the past 10 years. Currently, it's at 35.4. The only period when it has been higher than it is now was just before the dot-com bust of 2000, when it reached 44.2.

Another relevant measurement favored by Warren Buffett -- in fact, it has been nicknamed "The Buffett Indicator" -- is at an all-time high. The Buffett Indicator takes the value of the Wilshire 5000 index –- essentially, a proxy for the entire U.S. stock market -- and divides it by U.S. GDP. That indicator sits at 187.5%, just down from its recent all-time high of 195.7%.

Investors of late have been pretty sanguine about these alarming indicators. After all, the Federal Reserve has pledged to support the economy until the U.S. is all the way back to full employment. Meanwhile, people are getting inoculated with COVID-19 vaccines, and we are all looking forward to the economy fully reopening later this year.

But there are always ways for things to go awry. Some fear that efforts to support the economy will overstimulate it, leading to inflation. If inflation spikes too much, the Federal Reserve could raise interest rates earlier than anticipated, and higher interest rates could mean lower prices for stocks, since investors discount future earnings more in that scenario.

Yet before you panic and run for the sidelines, take a breath and keep some perspective.

The market is notoriously hard to predict

If you think you'll be able to foresee big market drops ahead of time, get out before they occur, and then buy back into stocks once prices hit bottom, good luck! That task is pretty much impossible, even for professionals. I don't think many foresaw a once-in-a-century global pandemic, nor predicted the magnitude of the December 2018 crash (which came in the wake of the last time the Federal Reserve raised interest rates).

And just because the market is near its all-time highs doesn't mean prices can't continue to march higher. Many thought that we were in a bubble for much of the 1990s, but it took years before it finally popped. 

In addition, no indicator is perfect. After all, the Schiller P/E exceeded its previous 2007 highs around 2015, and the market has still continued to march much, much higher from there. While the Buffett Indicator is even higher, remember that the denominator there is U.S. GDP, which plummeted last year amid the pandemic and its related economic shutdowns. 

Moreover, the composition of the market is different today. Big tech companies make up large parts of the U.S. economy, and based on their high-growth and capital-efficient businesses, their stocks should be valued more expensively than the asset-heavy market leaders of the past. Furthermore, interest rates are still at historically low levels, even after last week's "jump." In 1999, the rate on the 10-year Treasury was around 5%. In recent days, the 10-year rate "surged" to just 1.5%. 

Graph of 10-year treasury bond yield going down since 1980 until today.

Image source: St. Louis Federal Reserve bank.

Still, it's natural to be wary of risks when markets are booming to all-time highs. So if you are getting nervous, here are a few questions to ask yourself.

1. Do I have an emergency fund?

First, it's important for your peace of mind to have an emergency fund. A number of experts recommended having enough money to cover six months of living expenses stashed away in case of a job loss or emergency. However, you may opt for either more or less of a cushion, depending on your situation. In general, it's better to be more conservative on this score than not.

Having an emergency fund will not only help you handle unexpected expenses, it can also help you keep a cool head during market downturns. When you have no cash cushion and the market starts to plunge in a big way, you may be more likely to panic-sell, taking losses and missing out on the recovery that almost inevitably will follow. And if you have more in cash than you require to feel prepared for emergencies, you could even use some of the excess to buy stocks on the cheap during such downturns.

2. Do I have any large upcoming expenses in the near to medium term?

A family member of mine expects to buy a house within the next 18 months and asked me whether he should put some of the money he has saved for the down payment in the market in the meantime. After all, the market is going up, and the cash won't earn much in a savings account over the next year and a half.

The answer I gave? Keep all or most of that money in cash, CDs, money market funds, short-term Treasuries, or a high-yield savings account. Yes, he may miss out on some handsome gains, but if he invests it and there's a market crash, it could seriously interfere with those house-buying plans.

If you're in a similar situation, but are OK delaying your major purchase for a few years, then feel free to invest the money you intend to dedicate to it. Otherwise, it's best to keep most of those funds in cash-like alternatives.

Other looming expenses could include college tuition. And if you're nearing retirement, you may wish to take enough money out of equities to fund your near-term living expenses once you leave the working world behind, so that your monthly budgets are not directly at the mercy of the market.

3. Is there anything trading at reasonable prices?

Once you are secure in terms of your emergency fund and your large near-term expenses, it's probably best to stick to your investing plan and contribute set amounts to your 401(k) or IRA at regular intervals. Some people invest in indexes or ETFs, while others buy individual stocks or bonds. Whatever securities you prefer, it's best just to buy equal dollar amounts at regular intervals, so if prices are high, you'll buy fewer shares. If prices are low, you'll buy more.

However, if you prefer to invest in individual stocks and can't find anything that you think is undervalued or reasonably valued, then, by all means, keep that contribution in cash. Odds are, sooner or later you will get an opportunity to put that money to work. Maybe the discipline will force you to research more companies, with the likelihood of finding one or more promising candidates. There are almost always some undervalued stocks out there, even in an overheated market. You just have to keep looking.

Trying to time the market is a fool's errand

As we've seen, there are a number of reasons to include some cash in your overall capital allocation. That said, if you aren't nearing retirement and have all of your near-term cash needs covered, it's usually best to just keep investing, even if the market seems expensive.

Five, 10, or 20 years from now, it's highly likely the market will be higher than it is today, due to retained earnings and growth. True, there are always pessimists out there forecasting doom-and-gloom scenarios. Such predictions usually get lots of attention, but they usually don't make you rich. 

So stay the course. In the words of the famous investor Peter Lynch: "Far more money has been lost by investors preparing for corrections, or trying to anticipate corrections, than has been lost in corrections themselves."

Remember, the market has hit all-time highs many times in its history and has endured many recessions in order to get to the point where it is today. As long as you have an emergency fund and any near-term high-dollar expenses covered by cash or cash-like instruments, I wouldn't fear being fully invested, even with the stock market near its all-time highs.