In a historically bad year for hedge funds, one of their close relatives is thriving.

Computer-driven quants, which pick shares based on factors like momentum and size, have been the only hedge fund category to buy additional stock in 2016, data from Credit Suisse Group AG show. The move paid off as the S&P 500 Index crept within striking distance of all-time highs, while hedge fund managers were busy unloading shares.

It’s redemption of sorts for the quant momentum strategy which seized up in the first quarter. Up from the February lows, the tactics helped quants take advantage of an energy rally that fundamental managers missed, according to Mark Connors, Credit Suisse’s global head of risk advisory. As a result, computer-driven investors have been one of the few beneficiaries of a rally that has added more than $250 billion to energy stocks.

One element of quantitative analysis focuses on the speed at which prices are moving, a quantity expressed as the rate of change.

“When the rate of change of prices skyrocketed from 30 to 70 percent higher, that momentum is not lost on quants. Not only do they have a lens and a process that caught these changes, in addition, these managers were able to exit shorts and get long these names as they were rising,” said Connors. “Fundamental guys have a slower trigger. They’ll look at quarterly data, competitive pressures and other industry dynamics and company specifics.”

From the February low, quants tracked by Credit Suisse increased their exposure to stocks by 11 percentage points, while the measure for traditional hedge funds dropped more than 1 point. Over the same period, the S&P 500 rallied as much as 16 percent, boosting the quants’ returns for the year to as much as 8 percent, according to Connors. At the same time, the best of the hedge funds were flat.

For some, it’s a blow to the cause of human judgment in the stock market. Inputs not deeply steeped in mathematical models, like industry assessments and economic views, caused managers to hold onto bearish bets on energy. Although they were forced to cover as energy prices rallied, shorts remained anywhere from 20 percent to 60 percent of shares available among funds tracked by Credit Suisse prime services.

Among the big inputs for the typical quant fund are valuation and momentum, said Abhra Banerji, director of quantitative research at Evercore ISI. Because commodity-sensitive stocks had been sold off so sharply, quant funds’ valuation input likely flashed a buy signal, he said.

“The value part of the model would have suggested going long energy six months ago. The momentum part of the model would be suggesting to go long energy now,” said Banerji. “Definitely at this point, more energy stocks are momentum stocks than previously.”

Since the start of the year, the biggest sector shift in a momentum basket compiled by Evercore ISI occurred in energy shares. In January, the industry made up 6 percent of the basket. By June, the proportion rose to 18 percent, a larger jump than any other sector among the S&P 500’s 10 industry groups. The basket also increased its reliance on raw-material companies by 8 percentage points.