Profits are falling, valuations are the highest in a decade and the U.S. just reported the worst hiring since September 2010. Despite it all, stocks have strung together a series of up days that pushed the S&P 500 Index closer to a record than any time since July. How?

It’s a question tormenting bearish traders whose short bets against equities are higher than they’ve been almost 90 percent of the time since the financial crisis. Money has coursed out of shares and ended up in havens such as gold expected to do well in recessions.

And yet 10 months after stocks first went haywire, no recession has come. For all the frenzy of August and January, the U.S. economy has so far avoided the doom scenarios that raced through investors’ minds during a pair of 10 percent corrections. Time’s passage is taking some of the teeth out of the bear case.

“I’d really boil it down that a lot of fears and risks that dominated the sentiment earlier in the year appear to have stabilized,” said Joseph Tanious, an investment strategist at Bessemer Trust in Los Angeles, which oversees more than $100 billion. “The fact that we’re back to the levels where we were previously is definitely a sign that a lot of stress in the market has faded.”

Short sellers aren’t the only ones paying a price for pessimism. Last year, money leaving the U.S. found its way to European and Japanese markets, both of which are mired in losses in 2016 and about 20 percent below their peaks. Buyers who plowed $2 billion into exchange-traded funds that appreciate with stock market turbulence are also losing out.

U.S. stocks advanced Tuesday, sending the S&P 500 within 0.9 percent of the all-time high of 2,130.82 reached in May 2015. About 70 percent of stocks closed above their 200-day moving average on the New York Stock Exchange, the most since July 2014. Futures on the index expiring this month added 0.1 percent at 7:11 a.m. in New York.

Gains accelerated in the last two weeks, with the S&P 500 rising in all but three days to extend the rally from its February low to 15 percent. In the hours after the Labor Department said on Friday just 38,000 Americans were added to payrolls in May, stocks erased about two-thirds of their decline and have advanced in the two days since.

“The old saying about bull markets climbing a wall of worry is on full display,” said Howard Ward, chief investment officer of growth equities at Gamco Investors Inc., which oversees $38.7 billion in Rye, New York. “While earnings growth has been, in the aggregate, pretty nonexistent the past couple of years, today’s investors are looking to the future and anticipating better growth next year and beyond.”

One bull case on stocks says that investors who have been withdrawing from equity markets for six months will be forced to pile back in should the U.S. economy avoid catastrophe. And while the overall direction of money remains outbound, pockets of the market show the flow might be stabilizing.

According to Bank of America Corp., global stocks attracted fresh cash for the first time in eight weeks during the period through June 1, with U.S. equities the dominant destination. Hedge funds and large speculators raised holdings in S&P 500 futures to net long for seven straight weeks after the fastest retreat from a bearish stance in four years, data from the Commodity Futures Trading Commission show.

While U.S. equity funds lured $1.2 billion last week, it’s only a fraction of the roughly $60 billion withdrawn from the market since the start of the year. And despite a two-month decline, the number of bearish bets as a percentage of shares outstanding stood near 4 percent, compared with the average of 3.7 percent since March 2009.

“A lot of bearish sentiment was in the market, and still is, but that means a lot of the nervous sellers have been chased away,” said Walter “Bucky” Hellwig, who helps manage $17 billion as senior vice president at BB&T Wealth Management in Birmingham, Alabama. “The fact that the market has held in fairly well despite the negative results both in statistics and events is a pretty good sign.”

The strongest cases for selling the S&P 500 rests on its elevated valuation and slumping profits and the prospect of higher interest rates from the Federal Reserve. Another concerns companies themselves, which after snapping up trillions of dollars of their own stock in the last five years, cut announced buybacks by the most since 2009 in the first four months.

At 19.6 times 12-month earnings, the S&P 500 is trading at one of its highest multiples since 2004. Using the cyclically adjusted price-earnings ratio developed by Robert Shiller based on 10 years of earnings, the S&P 500 fetches a valuation of more than 26, way above its 135-year average of 16.6.

As pointed out by researchers such as AQR Capital Management’s Cliff Asness, while valuations have done a good job signaling expectations for future returns in stocks over the past century, they’ve been a less effective tool for market timing. High-priced stocks often go up, and cheap ones can continue falling.

To be sure, S&P 500 returns over any 10-year period show a correlation to valuation. A reading above 25 in the CAPE ratio, which occurred 10 percent of the time since 1881, has produced the worst equity performance, with the S&P 500 rising less than 0.2 percent a year in the ensuing decade. Levels below 10 saw the highest returns with a 6.6 percent annual gain.

But the relationship loosens to the point of uselessness when viewed through a narrower lens. Equity returns over any 12-month period rank best when the CAPE ratio is at its highest, mostly because it’s associated with investor euphoria that often spurs buying.

Stocks have gone without making a record for more than a year even as the rally since 2009 just became the second-longest bull market in history. While concern over the global economy has benefited U.S. stocks because of their perceived safety, the S&P 500 needs growth to pick up to sustain the rally, according to Gina Martin Adams, an equity strategist at Wells Fargo Securities LLC.

“Expectations for global growth have really broken down,” Adams said in an interview on Bloomberg TV. “We’re really struggling for that next engine of growth to develop.”

Investors should prepare for an earnings-driven rally as the dollar and oil, two major factors behind the yearlong profit decline, have shown signs of stabilization, according to  Richard Bernstein of Richard Bernstein Advisors LLC. Improving profits will counter a drop in the P/E ratio that’s likely to occur as the Fed continues to raise rates, he said.

Analysts expect S&P 500’s longest profit slide since the global financial crisis will end this quarter before resuming growth in the second half of the year, data compiled by Bloomberg show.

“It is always headline-grabbing to predict a calamitous end to a bull market, and a broad range of sentiment data strongly suggests investors are quite scared,” Bernstein said in a blog posting. “We continue to swim against that fearful tide, and our portfolios are positioned for a cyclical rebound in earnings and an earnings-driven bull market.”