This is not good advice. Time.com Time.com recently published a column advising a 33-year-old from Los Angeles who was trying to decide what to do with a newly gained $200,000 windfall. Their advice is clear in the article's title: "When Going All In Is Not A Risky Bet".

This has raised the hackles of some commenters, with stock market blogger Jesse Felder observing "File this under 'things you don’t see at the bottom.'”

Meanwhile, a Bank of America Merrill Lynch survey showed that over half of investors are worried that stocks and bonds are overvalued right now.

Even if we are near a market top, there's a good alternative to Time's all-in strategy to mitigate risk and even take advantage of falling prices.

There's A Correct Way To Buy Stocks If You're Convinced The Market Will Crash

The stock market is great for investors who have the benefit of long-term investing horizons. It's also better suited for investors who aren't concerned about perfectly timing market tops and bottoms.

Having said that, taking a longer-term view is good for investors worried that they may be buying at the top of the market.

A classic strategy called dollar-cost averaging can help reduce risks surrounding an asset falling in price. The concept is straightforward — you invest a fixed amount of money in an asset once every fixed time period. If the asset's price drops, you will be getting more shares of the asset for the same amount of money, and so if and when the price recovers, you will have spent less per share, on average, than if you had bought the shares at their peak pre-fall price.

Dollar-cost averaging isn't about losing money as the stock market falls. It's about buying increasing amounts of shares at cheaper prices, which means bigger returns during the rally.

How Dollar-Cost Averaging Worked Brilliantly During The Last Crash

To see this in action, we came up with a simplified thought experiment.

We considered what would have happened to an investor jumping into the stock market at the last peak: October 2007. This was arguably the worst time to buy. Our hypothetical investor puts $50 into an S&P 500 index fund at the start of every month, starting in October 2007 — the last stock market peak before the beginning of the great recession.

Here is what happened to the S&P 500 starting at that peak:

Business Insider/Andy Kiersz, data from Yahoo! Finance

The index dropped more or less steadily until the worst moments of the financial crisis in fall 2008, causing the full-on crash, and only began to turn around in March 2009.

The key to our investor's experiment is that they are staying consistent. No matter how stock prices move, they will always put $50 into the index fund on the first trading day of every month.

Based on changes in the value of the S&P 500 index, we calculated our investor's price return, less the $50 monthly cost:

The value of our investor's portfolio as of April 1, 2015, is $7,241.56. If they instead had taken their $50 each month and held it as cash, they would have just $4,550. So, the price return on this investment — even though they started at the last peak, just before the market started to go downhill — is $2,691.56.

This is a respectable 59.2% return. That averages out to about a 6.3% annual rate of return.

To get another perspective on this, here is the percent gain or loss, compared to taking $50 each month and holding it as cash:

Business Insider/Andy Kiersz, data from Yahoo! Finance

Things start out looking pretty dire, as the economy fell into its deep recession through mid-2009, with the S&P 500 reaching a minimum in March of that year. At the lowest point for our investor, at the start of February 2009, they would be down about 36%.

Because human beings are often overly averse to risk, our hypothetical investor might have been tempted to abandon their investment plans during the bad months. That is, they might look at this chart and panic about the drop:

Business Insider/Andy Kiersz, data from Yahoo! Finance

But if our investor sticks with their plan and keeps putting $50 in every month, even through the dark times, once the market bounces back, they end up doing quite well:

Business Insider/Andy Kiersz, data from Yahoo! Finance

Here's Why You Never Hear About This

Unfortunately, dollar-cost averaging isn't sexy. It's much sexier to sell at the top and buy at the bottom.

Obviously, your returns would be much higher if you win the stock market lottery by perfectly timing the tops and bottoms of the market. However, almost everyone who tries to do this will find themselves losing money and lots of it.

If you are investing for the long haul and can hang on through watching your portfolio's value drop temporarily in bad times, starting to invest in stocks, even near a peak, may not be as terrifying as it looks. The market has always bounced back sooner or later; so if you can hold on until that later, don't panic.