Stocks moved broadly higher on Wall Street in afternoon trading Friday as investors closed out a wobbly week ahead of key trade talks between the U.S. and China.

Every major index was headed for a weekly loss, but still solidly on track to close the month and quarter with solid gains.

A wave of selling swept over the market for most of this week as traders shifted money to less risky holdings like U.S. government bonds while remaining cautiously optimistic about this weekend’s meeting In Japan between President Donald Trump and President Xi Jinping of China.

Investors are hoping the talks put the world’s two biggest economies on track to resolve their trade dispute, which has led to costly tariffs imposed by both countries on each other’s goods. Wall Street is worried the fallout from the tariffs could hurt global economic growth and corporate profits.

Banks led the way higher after the Federal Reserve late Thursday approved plans by the country’s 18 biggest banks to return more money to shareholders. The approvals were part of the Fed’s annual checkup of the banking system. JPMorgan Chase rose 2.7% and Bank of America climbed 3%.

Industrial and energy stocks also notched strong gains. Union Pacific rose 1.5% while oil companies including Chevron and Exxon were broadly higher.

Technology stocks lagged the most, weighed down by 3% drop for Cisco Systems. Apple fell following the departure of its highly regarded chief of design, Jony Ive.

Health care stocks also declined, led by a 2.1% drop in Biogen. UnitedHealth Group also fell, losing 1.5%.

KEEPING SCORE: The S&P 500 index rose 0.3% as of 2:20 p.m. Eastern time. The benchmark index is on track to end the month with a 6.6% gain.

The Dow Jones Industrial Average rose 48 points, or 0.2%, to 26,574. The Nasdaq composite rose 0.2%.

Major stock indexes in Europe rose.

JUNE JUMP: Every major index is on track to close out the month at least 6% higher. June marked a sharp about-face from May, when traders fled to safer holdings because of increased anxiety over trade disputes and global economic growth. The S&P 500 reached a record closing high on June 20, though it has retreated slightly from that mark.

Stocks are also posting their second straight quarter of gains. The S&P 500 is on track to increase 3.4% in the second quarter but only after taking investors on a rollercoaster ride. It climbed steadily in April, dove in May and then climbed again in June. The index rose 13.1% in the first quarter.

Investors are in good shape for the year so far. The S&P 500 is up 17% and the technology-heavy Nasdaq has gained 20.3%.

JULY HEAT: Investors are heading into the first week of July closely watching for any developments from trade talks between the U.S. and China. Trump and Xi will meet this weekend in Japan, marking their first meeting since the trade war escalated following 11 rounds of negotiations.

Investors fear that a drawn-out trade war will crimp economic growth, and uncertainty over the impact of the conflict has thrown markets into a series of volatile swings. The dispute has prompted the Federal Reserve to say it is willing to cut interest rates if the dispute hurts the U.S. economy.

ANALYST’S TAKE: Trade-war induced volatility isn’t going anywhere soon and investors are going to have to come to terms with that, said Kristina Hooper, chief global market strategist at Invesco.

“Investors need to recognize that the trade situation is unlikely to improve,” she said. “The best we can hope for is an agreement to continue talks.”

STRESS RELIEF: Bank stocks gained ground after they were given the thumbs up by the Federal Reserve to give investors more cash.

JPMorgan, Bank of America, Wells Fargo and others all passed the most recent round of “stress tests” meant to assess whether they could survive a sudden economic downturn. They were mandated following the Great Recession a decade ago.

The results mean that banks can raise their dividends and buy back more shares this year and still have enough capital to survive a hypothetical deep recession in the next year. Read more at AP