What happened

Shares of Trex (TREX -1.08%), a manufacturer of composite decking products, were swooning last month as the company slashed its guidance for the year in its second-quarter report. Like homebuilders and other housing stocks, Trex is seeing stiff headwinds in the market as interest rates rise and consumer demand for home improvement products cools.

According to data from S&P Global Market Intelligence, the stock finished August down 27%. As you can see from the chart below, Trex shares fell on the company's earnings report in the second week of the month, and continued to slide as market sentiment soured over comments from Federal Reserve Chair Jerome Powell about economic pain resulting from interest rate hikes.

^SPX Chart

^SPX data by YCharts

So what

Trex stock fell 15% on Aug. 9 after the company released earnings, even though second-quarter results were solid. The company posted 24% revenue growth to $386.2 million, ahead of the consensus at $380.6 million as it benefited from price increases. Volume was up by just mid-single digits, showing most of the revenue growth was driven by price. The expansion of its premium decking line Transcend also seemed to give a boost to the top line.

Profit growth was strong as well as gross margin rose 270 basis points to 40.7%, reflecting price increases and cost efficiencies, and earnings before interest, taxes, depreciation, and amortization (EBITDA) increased from 41% to $129 million, or an EBITDA margin of 33.4%. On the bottom line, earnings per share jumped 49% to $0.79, beating analyst estimates at $0.68.

What sank the stock was a sharp cut in guidance as the company said it experienced a sudden reduction in demand in June from the professional channel as contractors adjusted inventory levels in line with expectations of an economic slowdown. As a result, the company expects just $185 million to $195 million in revenue in the third quarter, which was well below the analyst consensus at $355 million.

For the fourth quarter, it called for $180 million to $190 million in revenue, and said full-year adjusted EBITDA margin would be around 27% to 29%.

Though the stock briefly recovered some of those losses, over the rest of the month, shares slid as the broad market fell over fears of a sustained period of high interest rates, which would impact home improvement companies like Trex.

Now what

Trex stock has been a strong performer over the years, and the company has little direct competition in the composite decking category. However, last month's sell-off was a reminder that cyclical headwinds impact even strong companies, especially in industries like homebuilding.

While Trex still looks like a good bet over the long term, it will take some time for the stock to recover if the current macroeconomic headwinds prove to be enduring.