One of the surprising outcomes of the pandemic was a booming housing market. The combination of low interest rates, stimulus payments, and a suspension of some student loan repayments sent housing prices through the roof. From May 2020 through the summer of 2022, the median sales price of both new and existing homes in the U.S. rose about 50%. That's compared to the roughly 3% average annual increase in the previous 30 years.

Among the companies that benefited from the rapid climb, Trex (TREX -0.93%) has been one of the worst-performing stocks. It's down 9% since the end of 2019 and has fallen a whopping 70% from its peak about this time last year. It might even fall further.

Riding the wave of housing appreciation

Housing is cyclical, and since Trex makes composite decking and railing, its sales and profitability are cyclical, too. If homeowners have money to spend and feel confident that the value of their homes are rising, they're more likely to renovate. And outdoor living space is one of Americans' favorite ways to spruce up their homes.

Exterior improvements are the fastest-growing renovation segment. And the last decade shows just how much the company has benefited from this knock-on effect of home-price appreciation.

Four years after the massive downturn in home prices of 2008-2009, the stock was trading around two times sales. Since then, the median home price of new and existing homes in the U.S. rose as much as 133% and 85%, respectively, through August.  

Over that span, the company tripled sales and grew its profitability nearly 600% as measured by its operating margin. Naturally, Wall Street also gave the stock a higher valuation, pushing its price-to-sales ratio (P/S) up by the same 600%.

TREX PS Ratio Chart

TREX PS Ratio data by YCharts.

Wiping out as interest rates spike

With many of the catalysts for the housing boom now reversing, the valuation has come crashing down to below four times sales. The fed funds rate that was at zero is now between 4.25% and 4.50%. That propelled 30-year mortgage rates near 7% -- more than double where they spent much of 2021.

Housing-price appreciation has been stopped in its tracks. In many cities, it has reversed. As homeowners worry about the equity in their homes, their willingness to renovate has collapsed.

The delinquency rates of debt like auto loans and credit cards are also starting to show signs of stress. That means mortgages and home equity lines of credit may not be far behind. 

Chart showing serious delinquency rate by loan type.

A sinking feeling about the near term

Trex is already feeling the effects. When management reported second-quarter results in August, it predicted those headwinds would persist for the rest of the year. It was a prescient call. As distributors sold off inventory rather than entering new orders, the company's sales and profitability fell.

During the third quarter, revenue was 44% less than the same period of 2021. Earnings per share fell 80%. Inventory was up almost 60%. Management affirmed that the fourth quarter would not be much different.

As bad as it sounds, it could get worse for shareholders. The P/S ratio is still double what it was back in 2013. That means it wouldn't be unprecedented if the stock got cut in half, despite already falling 70%. 

Still a long-term buy

I still hold shares and believe they are a compelling long-term investment. Composite decking (non-wood) only captures about one-quarter of the $8 billion market. For context, Trex generated about $1.2 billion in sales over the last 12 months. And its web properties capture nearly two-thirds of the web traffic in its category. 

Management has also earned the benefit of the doubt. The company has a long history of continuously improving operations to increase throughput and reduce costs. Although CEO Bryan Fairbanks -- who took over the role just before the pandemic -- has a finance background, he has been with the company since 2004 in a variety of roles. For that reason, operational problems would be far more worrying to me than macroeconomic issues.

If history is any guide, the strongest companies get even stronger through recessions. For those who can accept the risk, Trex will likely be a shining example of that phenomenon in the years ahead.