(The Aug. 18 story is refiled to fix typo and link in eighth paragraph)

A screen displays the Dow Jones Industrial Average after the closing bell on the floor of the New York Stock Exchange (NYSE) in New York, U.S., August 17, 2017. REUTERS/Brendan McDermid

NEW YORK (Reuters) - The Trump-fed rally in stocks, lately showing signs of faltering as the long Wall Street summer nears its end, faces a key test in the weeks ahead with the approach of a historically unkind season for equities and a clutch of issues - such as raising the debt ceiling - awaiting the return of lawmakers to Washington.

With September, typically the worst month in the year for stocks, on the doorstep, investors are likely to be nervous that cracks seen in the more than-eight year bull run in equities will turn into a steeper selloff.

“September is historically one of the most volatile months of the year,” said Michael Purves, chief global strategist at Weeden & Co in New York. “Why do you want to chase the S&P right now if there’s a good shot that September can be an ugly, volatile month.”

On Thursday, the S&P 500 .SPX recorded its biggest daily percentage drop in three months, hurt by speculation about White House Economic Adviser Gary Cohn's possible departure, and failed to reverse course even after the White House said he was not leaving. Stocks edged higher on Friday.

The weakness came just as stocks were recovering from last week’s swoon on worries linked to escalating tensions between North Korea and the United States.

The market is up more than 8 percent so far this year, fueled by hopes of bumper corporate earnings and expectations that the Trump administration’s policies will spur growth. Yet the catalysts could be over.

“This wave of good news coming in the form of this double-digit earnings growth is in the rear-view window now and I think it’s kind of hard to look out and see what’s the catalyst to get buyers to jump back in aggressively,” said Eric Kuby, chief investment officer, North Star Investment Management Corp., Chicago.

For a graphic on historical performance of major U.S. stock indexes, click: reut.rs/2idvaqd

BUY THE DIP?

Cracks have started appearing in the market’s relentless rally.

Thursday marked the seventh straight day in which the NYSE and Nasdaq had more stocks making new 52-week lows than highs, the longest stretch since Trump’s election.

At Thursday’s close, for a rolling period of one month, 509 more stocks had fallen each day on average than risen, the largest skew to the downside since Trump took office. When the market closed at a record high on Aug 7, more stocks ended the day lower than higher.

“There are some cracks in market breadth,” said Peter Cecchini, chief market strategist at Cantor Fitzgerald in New York, who said he has grown more cautious in recent weeks.

The S&P 500 is trading at 17.7 times expected earnings - down marginally from March, when it hit a high not seen since 2004 - a level many investors consider expensive and increasing the risk of a market selloff.

“When you’re at these valuation levels in a lot of these names, it doesn’t take much,” said Stephen Massocca, senior vice president, Wedbush Securities in San Francisco.

History is against stocks: September ranks as the worst month for stocks, according to the Stock Trader’s Almanac, producing an average price return for the S&P 500 of negative 0.5 percent.

Weeden’s Purves cited factors such as the debt ceiling, seasonal patterns and a Federal Reserve meeting as reasons for caution and said he was recommending people buy hedges such as S&P puts.

The U.S. Congress will need to raise the nation’s debt limit by early to mid-October to avoid defaulting on loan payments, the Congressional Budget Office said in June. But the specter of another potential clash has been raised even as Republicans control both Congress and the White House

The U.S. Federal Reserve’s next meeting on Sept. 19-20 is also seen as a possible near-term risk factor for stocks. In minutes of its last policy meeting in July, released on Wednesday, the Fed reinforced expectations that at its next meeting it will announce when it will start to wind down its $4.2 trillion bond portfolio.

“Perhaps the biggest worry is the potential unwinding of global central banks’ vast quantitative easing stimulus programs in the coming months,” said Fawad Razaqzada, Market Analyst, Forex.com, in a research note.

Still, any pullback gives investors an opportunity to buy and investors are watching for those dips.

“This has been a ‘buy on the dips market’ and we do believe that pattern will hold. It’s just a question of how big that dip is,” said David Schiegoleit, managing director of investments, U.S. Bank Private Wealth Management in Newport Beach, California.