A man closes his umbrella designed like the British flag as he enters a taxi with his companion during a downpour in Hong Kong. Hong Kong stocks ended slightly lower on June 28, unable to match an Asian rebound from last week's Brexit-fueled selloff because of its exposure to Europe-linked companies. (Anthony Wallace/AFP/Getty Images)

U.S. stocks showed signs of life on Tuesday, trading in positive territory for the first time since Britain’s decision to leave the European Union sent global markets into a tailspin.

All of the major indexes, including the Dow Jones industrial average and the Standard & Poor’s 500-stock index, gained ground as bargain hunters scooped up shares that had been depressed by one of the worst sell-offs this year.

But, markets analysts said, the fallout from Britain’s pending exit from the E.U. — popularly known as Brexit — will unfold over months, if not years, ensuring market volatility will return.

“The risk for the average investor is the markets just bleed lower” over a long period, said Lisette Cooper, chief executive of Athena Capital Advisors. “Uncertainty breeds volatility and . . . the news stream is not going to be good.”

Investors have been on edge since the Brexit vote stunned the world. Global markets lost more than $3 trillion in value over two trading days. And the value of the British pound plummeted while investors rushed to buy gold, a traditional safe haven when markets are unstable.

The uncertainty sparked by Brexit could send stocks into a prolonged period of volatility.

The Dow, which tracks 30 blue-chip stocks, and S&P, a broader view of the market, rose 1.6 percent and 1.8 percent respectively. The tech-heavy Nasdaq rose about 2.1 percent. After several days of steep losses, London’s main FTSE 100 index gained 2.6 percent and Germany’s DAX climbed about 2 percent.

[Why Wall Street fought so hard against Brexit]

“The market is oversold right now, so you are going to get the bottom fishers coming in to lend some support," said Michael Mullaney, chief investment officer of Fiduciary Trust Company.

Even U.S. and European banks, which had suffered some of the biggest losses in recent days, mounted a comeback on Tuesday. JPMorgan Chase and Morgan Stanley rose 3 percent and 4 percent respectively. After falling by double digits in recent days, the Royal Bank of Scotland gained about 3 percent.

The clearest sign of investors regaining their footing may be in the British pound. After suffering its biggest one-day drop in history on Friday, and then falling again Monday, it was lumbering at a 31-year low against the dollar. On Tuesday, the pound rose about 1 percent against the dollar.

“The market is oversold right now, so you are going to get the bottom fishers coming in to lending some support," said Michael Mullaney, chief investment officer of Fiduciary Trust Company, a wealth management firm.

But, market analysts say, Tuesday’s bounce may be a temporary reprieve rather than a turning point. “I don’t think the worst is over,” said Jack Ablin, chief investment officer for BMO Wealth Management.

Even as some bargain hunters swoop in, the markets are likely to remain jumpy as Britain begins to negotiate its exit from the E.U. over the next few months and the fallout from the historic vote comes clear, analysts said. If Britain’s divorce from the E.U. prompts other countries to follow with their own exit or throws the country into a recession, as some economists have predicted, U.S. stocks are likely to feel the aftershocks, analysts said.

“There is still a lot of uncertainty out there. What is the timeline for the exit? What is the process going to be,” said Jim Davis, regional investment manager for U.S. Bank. “It is just a lot of uncertainty.”

And despite Tuesday’s slight rebound, the British pound is still historically low against the dollar, and the Dow and S&P remain in negative territory for the year.

“Think about this like an earthquake,” Mullaney said. “There are going to be secondary shocks.”

Some aftershocks may take time to materialize, said Cooper from Athena Capital. For example, the market volatility has strengthened the dollar, a relatively safe bet for nervous investors. But a stronger dollar could hurt China’s efforts to stabilize its economy, she said.

“I’m most concerned about what happens in China,” said Cooper. “The dollar strengthening is very bad for them and increases the risk of a hard landing.”

Read more:

E.U. leaders toughen line over British ‘divorce’

Britain confronts a wave of racist incidents after the Brexit vote