Stocks are at all-time highs, but the toughest month for the market looms

  • The Dow averages a decline of 0.7 percent while the S&P 500 falls 0.5 percent, on average, in September, data from "Stock Trader's Almanac" show.
  • Investors could also experience added volatility in September as a U.S. midterm election looms. The Dow and Nasdaq's September losses widen ahead of midterms.
  • Wall Street will likely kick off September with equities trading at, or near, all-time highs. The Dow is within striking distance of a record, and the S&P 500 and Nasdaq hit all-time highs this week.

Stocks have been on a tear lately, ripping to record highs, but investors could be in trouble as September starts off, if history is any indication.

September has been the worst month for the Dow Jones Industrial Average and the broader S&P 500 since 1950, according to data from "Stock Trader's Almanac." The Dow averages a decline of 0.7 percent, while the S&P 500 falls 0.5 percent on average in September, the data show. The Nasdaq Composite, which was introduced in 1971, falls half a percent on average.

"September and October have some pretty bad reputations in the market, but especially September," said Tim Courtney, chief investment officer at Exencial Wealth Advisors. "You're always wary to say things are going to be cheery heading into historically tough parts of the year for markets."

Wall Street will likely kick off September with equities trading at, or near, all-time highs. The S&P 500 and Nasdaq both hit record highs on Tuesday. Meanwhile, the Dow traded about 2 percent from its record high.

U.S. equities got a boost after the U.S. and Mexico struck a trade deal that paves the way for a replacement for NAFTA, the current deal that includes those two countries and Canada. Trade fears kept a lid on stock gains prior to August as investors assessed the potential effects of more protectionist policies from the U.S. and its biggest partners.

The almanac's data show September has kicked off strongly in 14 of the past 23 years, but those gains faded quickly. "As tans begin to fade and the new school year commences, fund managers tend to clean house as the end of the third quarter approaches, causing some nasty selloffs near month-end over the years," said Jeffrey Hirsch, editor of "Stock Trader's Almanac," in a note last week.

Investors could also experience added volatility in September as a U.S. midterm election looms. The Dow and Nasdaq's average losses for September widen to 1 percent and 0.8 percent, respectively, in midterm election years. The S&P 500's losses improve slightly to an average of 0.4 percent, however.

WATCH: Historic bull market: A roller coaster ride through the past 10 years