Traders work on the floor at the New York Stock Exchange (NYSE) in New York, U.S., September 12, 2019. REUTERS/Brendan McDermid (Brendan Mcdermid/Reuters)

It’s a stock market that won’t stop.

The last few months have been packed with bad news: trade war salvos, U.S. threats against Mexico, a currency scare, a looming warning called “yield curve inversion“ and chaotic presidential tweets.

Yet U.S. stocks surged this week to within striking distance of all-time highs, earning hundreds of billions back for investors after a tumultuous August.

The Dow Jones industrial average capped an eight-day win streak on Friday, closing at 27,215, up 37 points and less than 1 percent off its all-time high. Standard & Poor’s 500 Index and Nasdaq Composite closed down Friday, but were up for the week. The S&P snapped a three-day win streak, closing down 2.37 points to finish at 3,007. The Nasdaq was flat as well, down only 18 points or 0.22 percent, closing at 8,176.

All three averages have posted three straight weeks of gains.

”It’s called TINA,” said investment manager Michael Farr. “There Is No Alternative.”

With the Eurozone economy ailing and its bond market demanding investors pay banks and governments to hold their savings rather than the other way around — called “negative yield” —the U.S. stock and bond markets are two places where savers can make a return on their investments.

“With short-term bond yields crashing around the world, the U.S. stock market has become the new safe haven,” said Chris Rupkey of MUFG Bank. “The U.S. is definitely pulling up other nations in the equity market.”

The U.S. economy has been strong, though there have been warning signs for the decade-long expansion. Economic growth and job growth, while still headed upward, have slowed. Inflation is up slightly and jobless claims dropped last week.

U.S. unemployment remains at a record low. Gasoline prices are cheap. Interest rates are favorable, and August retail sales reported on Friday showed a rise of 0.4 percent, further evidence of a consumer summer buying spree.

Consumer confidence numbers on Friday showed continued improvement, a sign that the recent trade detente between the Trump administration and China may be calming American households.

Technology stocks have propelled the last several years of the bull market, but the push in the last few weeks has come from so-called “value stocks.” Those are the big, dividend-paying companies in the health, financial and industrial sectors that have taken a back seat to the big technology names such as Apple, Facebook and Google.

Technology stocks have been under fire from regulators.

The iShares Russell 1000 Value ETF has gained more than 4 percent over the past month compared to 2 percent for the tech-heavy Nasdaq.

“The Nasdaq has stalled and the S&P has come up,” said Farr, adding that technology stocks have become expensive. “There has been a rotation out of tech and into value.”

Leading the blue chips on Friday were big legacy names such as UnitedHealth, Dow chemical, JPMorgan Chase, Boeing and Caterpillar.

The stock recovery is concurrent with a relaxation in trade tensions between the U.S. and China. The two sides are scheduled to resume trade talks in October.

China announced this week that it would exempt from further tariffs 16 products that it imports from the U.S., from cancer pharmaceuticals to medical equipment. President Trump responded by saying he would delay by two weeks a tariff increase on $250 billion in Chinese products.

China on Thursday proposed a way to break the trade impasse between the two sides by separating national-security issues from pure trade disagreements.

There’s something else going on. President Trump has been relatively quiet the last two weeks, allowing the U.S. economy to speak for itself.

“When Trump goes dark. When he is not tweeting and tossing bombs at somebody every five minutes, investors can focus on the broader picture, the economic fundamentals,” said Kenny Polcari of ButcherJoseph Management. “That’s the stuff that’s really important versus getting drawn into the chaos he causes by his tweets.”

A relatively peaceful September on the tweet front followed a hectic August that roiled markets. On Aug. 5, China allowed its currency to weaken. The U.S. Treasury Department formally name China a currency manipulator. The Dow dropped 767 points that day.

A historically reliable barometer of a recession known as the yield curve inversion emerged out of the bond market on Aug. 14, lopping 800 points — or 3 percent — off the Dow.

And on Aug. 23, on the eve of the G-7 summit in France, Trump released a series of tweets that said he would broaden and bolster tariffs on hundreds of billions of dollars’ worth of Chinese imports. Trump also demanded that American companies stop doing business with China. In another tweet, Trump called Federal Reserve Chairman Jerome Powell an “enemy,” and compared him to Chinese President Xi Jinping.

Stocks plunged, erasing $825 billion from the Wilshire 5000 Total Market Index.

Since then, the president has been relatively quiet on the economy, although he boasted in a tweet on Friday that he “has helped create perhaps the greatest economy in the history of our country.”

Adding to the stock recovery is the fact that there has been little discussion of a yield curve inversion since bond yields began migrating back to normal in the last few days.

“Yield curve inversion has not been in the same sentence in three weeks,” Polcari said. “That’s a huge positive.”