When the stock market is in a bull market and the share prices of different securities are appreciating in value, investing may seem easy. And barring serious issues for a specific industry or company, most things that you buy will grow in value as well.

But all good things must come to an end. And whether it's tomorrow, next week, or next year, the stock market could crash. This change in direction doesn't mean that you should stop investing, though. Instead, you should try implementing this simple strategy. 

Businessperson standing in front of a chart with crashing arrow.

Image source: Getty Images.

What it is and how it works 

When you dollar-cost average, you are investing a pre-determined amount of money into a particular investment over a certain period of time. This occurs no matter what the stock market is doing or the cost of shares at that time. This will result in you getting lower prices some months while getting higher prices other months. The table below shows what buying $1,000 worth of SPDR S&P 500 ETF Trust (NYSEMKT:SPY) each month at its closing price over the last 12 months would've looked like. 

  Investment amount  Share price  Total shares purchased
Aug. 7, 2020 $1,000 $334.57 3
Sept. 8,  2020 $1,000 $333.21 3
Oct. 8, 2020 $1,000 $343.78 3
Nov. 9, 2020 $1,000 $354.56 2.8
Dec. 8, 2020 $1,000 $370.17 2.7
Jan. 8, 2021 $1,000 $381.26 2.6
Feb. 8, 2021 $1,000 $390.51 2.6
March 8, 2021 $1,000 $381.72 2.6
April 8, 2021 $1,000 $408.52 2.44
May 7, 2021 $1,000 $422.22 2.4
June 8, 2021 $1,000 $422.28 2.4
July 8, 2021 $1,000 $430.92 2.3
Total amounts $12,000   31.84

Calculations by author.

Using this strategy, you would've made purchases totaling $12,000 and gotten 31.84 shares for an average share price of $376.88. Over the last 12 months, the cost of SPY has increased in value by almost $100 a share, but if the opposite had happened and we were in a period of declining prices, your average share price would be exactly the same. 

The alternative to dollar-cost averaging is investing a lump sum of money. If you did this a year ago on Aug. 8, 2020, your $12,000 would be worth $15,449. But if the opposite had happened -- you invested $12,000 at the high price of $430.92, and the shares plummeted 23% to $334.57 -- your account value would decline to $9,317. Using a dollar-cost averaging method, you still would've lost money, but less since only a portion of your shares is invested at higher prices.

When it works

If you could tell exactly when the stock market would enter a bear market, you could perfectly time sales of your securities and avoid these losses. And if you knew when it would rebound, you could plan on buying shares back at this time. But timing the market is very hard, and although you may get lucky from time to time, for the most part, it will be a guess. 

This type of investment strategy will work during a bear market, flat market, or bull market because of the uncertainty that exists around if or when a crash could be coming. But it could be especially helpful in calming your nerves and getting you invested instead of sitting on the sidelines in cash if you are fearful of a stock market crash.

When the stock market dropped 34% in March 2020 due to fears of COVID-19, you may have found yourself in this exact scenario. But instead of being long-lasting, this stock market crash had a quick recovery, and shares of SPY are worth 200% more -- or double today than they were then.

If you were waiting for the perfect opportunity, you could still be holding cash. If instead, you'd committed to this method of investing, you would've deployed your money slowly into the stock market over the last year and a half and would've reaped these gains. 

When you invest, you may find yourself afraid of buying or selling your investments at the wrong time, which is normal. But unchecked, these fears could prevent you from experiencing stock market growth. An investing strategy that will help you develop consistency through any market cycle can help prevent this. 

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.