Traders work on the floor of the New York Stock Exchange. Worldwide markets were rattled by higher volatility in the past week. (Justin Lane/Epa-Efe/Rex/Shutterstock/Justin Lane/Epa-Efe/Rex/Shutterstock)

U.S. stocks surged Monday, recovering from some of the wreckage left by two weeks of brutal trading that wiped out trillions of dollars in market value.

The Dow Jones industrial average climbed 409 points, or 1.7 percent, in trading Monday. The broader Standard & Poor’s 500-stock index and the tech-heavy Nasdaq were both up about 1.5 percent. The gains were buoyed by strength in the share prices of oil and gas companies.

U.S. investors have been torn between enthusiasm for the massive tax cut passed by Congress last year that could provide a huge stimulus to an economy already at full employment and growing fears that interest rates will jump as the federal government borrows massive amounts to cover its growing deficits.

The Dow swung more than 1,000 points, or about 4 percent, on Friday, capping one of the worst weeks on Wall Street since the global financial crisis. Investors, who in January set a monthly record for sinking money into equity funds, pulled their money out at a record pace in the week ending Feb. 7, according to EPFR, a Cambridge, Mass., firm that has tracked such data since 2000.

The rise in stock prices Monday is giving some investors hope that the worst may be over. After several broken records, investors had pushed stock prices too high, and it was time for a correction, said Jack Ablin, chief investment officer at Cresset Wealth Advisors.

“The market was probably 10 to 15 percent overvalued and we got a 10 percent correction,” said Ablin, who said he moved one client into the stock market on Friday.

On Monday, the Dow, composed of 30 well-known company stocks, surged, with Boeing and Apple shares up around 4 percent. General Electric posted a loss. All 11 sectors in the S&P 500 pushed higher, led by energy and technology.

But some market analysts warned that Monday’s quick rise in stock prices may be a sign that after more than year of market calm, volatility but not necessarily optimism had re-emerged. Whether the recent sell-off is a short-term hiccup or the end of the longest bull markets in a decade is still unclear, they said.

The benchmark indexes remain far from the record highs that had dazzled investors for more than a year. The S&P 500 has lost about 10 percent and $2.5 trillion in value since late January.

“While this feels unprecedented and feels like a massive change in investors’ behavior, all we have really done is return to a more normalized market,” said Todd Hawthorne, lead portfolio manager at Boston Partners.

While the markets were repeatedly marching though record-high territory over the past year, even mediocre companies benefited, analysts said. That will probably not be true going forward, they said.

“So good companies with reasonable valuations will be rewarded and companies with poor fundamentals will be punished,” Hawthorne said.

The mood of traders this week could hinge on the reception of President Trump’s budget plan. The plan calls for a range of spending cuts that reduce the growth of the deficit but does not attempt to balance the federal budget, according to The Washington Post. Trump also unveiled a plan to spend $1.5 trillion on the country’s ailing infrastructure over the next decade.

On Wednesday, traders are also expected to respond to data on inflation when the consumer price index is reported.

The correction was long overdue and may last a few more weeks, but there may still be room for U.S. stocks to rise another 10 to 15 percent before the end of the year, said Douglas Cohen, a managing director at Athena Capital Advisors. The combination of corporate tax overhaul, overseas economic growth and investor confidence, or “animal spirits,” should keep stocks moving higher, though probably in a more volatile environment, he said.

“My view is that the backdrop is still favorable enough,” he said.

Overseas, markets were also generally rising as well. Japan’s Nikkei was closed Monday, but other indexes in Asia were holding their own. South Korea’s Kospi gained 0.9 percent. Europe’s exchanges were up more than 1 percent across the board. Germany’s benchmark DAX index rose about 1.5 percent Monday.