Stocks on Wall Street have ended their strongest week in five years and have now recovered more than half the losses they suffered at the beginning of the month.

Investors got back to buying stocks almost as quickly as they started dumping them.

The gain on Friday was the sixth in a row for the Standard & Poor’s 500 index.

A combination of cheaper prices for stocks as well as solid company profits put investors back in a buying mood.

The S&P 500, which many index funds track, has risen almost 6% in its current streak.

Investors have not hesitated to buy the same types of stocks that did well before the market’s recent slump, including technology companies and banks.

In a typical market downturn, investors might avoid stocks that have had huge run-ups out of fear they had become too expensive.

Instead, investors are still betting on more strength in the economy and are buying companies that tend to do better in times of faster growth.

After an unusually long period of calm, stocks plunged at the start of February as investors worried about inflation and rising interest rates.

The S&P 500 fell as much as 10% from its latest record high reached January 26, but investors were not scared off for long.

“Rates started to stabilise and you got some better economic data, and earnings in general have been pretty good,” said Sameer Samana, global equity and technical strategist for the Wells Fargo Investment Institute.

He said bond and credit markets showed that the fear was not spreading.

Companies were still able to borrow at relatively low rates, which showed lenders weren’t concerned the economy was weakening.

“A lot of people probably looked at stocks vs. credit and probably thought ‘if credit’s not feeling it, things must not be all that bad,'” he said.

The S&P 500 gained 1.02 points, or less than 0.1%, at 2,732.22. That includes a gain of 4.3% this week, its best since January 2013.

The Dow Jones industrial average rose 19.01 points, or 0.1%, to 25,219.38. The Nasdaq composite lost 16.96 points, or 0.2%, to 7,239.47.

The Russell 2000 index of smaller company stocks climbed 6.35 points, or 0.4%, to 1,543.55.

House builders rose after the US commerce department reported that construction of new homes jumped 9.7% in January.

That was the highest level since October 2016, and permits, a sign of future construction, also climbed.

The Dow was up 232 points shortly before Special Counsel Robert Mueller announced the indictment of 13 Russians and three Russian organisations in a plot to interfere in the 2016 US presidential election.

Stocks gave up their gains after that and spent the afternoon meandering between small gains and losses.

The indictment says the Russians used social media propaganda, at times helping Donald Trump and harming the prospects of Democrat Hillary Clinton.