Stocks drifted in a narrow range on Tuesday, and the Dow Jones Industrial Average (DJINDICES:^DJI) and the S&P 500 (SNPINDEX:^GSPC) ending up posting small gains.

Today's stock market

Index Percentage Change Point Change
Dow  0.12% 28.50
S&P 500  0.09% 2.43

Data source: Yahoo! Finance.

Stocks of consumer goods companies generally rose after some positive earnings reports, and the Consumer Staples Select Sector SPDR ETF (NYSEMKT:XLP) added 0.82%. Crude oil prices continued to advance, boosting the shares of stocks in the energy industry. The SPDR S&P Oil & Gas Equipment & Services ETF (NYSEMKT:XES) rose a significant 2.05%.

As for individual stocks, Under Armour (NYSE:UA)(NYSE:UAA) announced quarterly results that caused its stock to fall sharply, while Trex (NYSE:TREX) soared on strong sales gains.

Abstract stock charts.

Image source: Getty Images.

Under Armour continues to struggle domestically

Under Armour announced disappointing third-quarter results and revised its outlook for the rest of the year downward, sending the stock plunging 24%. The company posted its first-ever quarterly revenue decline, with sales dipping 4.5% to $1.41 billion. Earnings per share were $0.12, or $0.22 excluding one-time items relating to the company's restructuring efforts, compared with $0.29 in the same period last year. Guidance for full year revenue was cut to a low-single-digit percentage increase, compared with last year's 22% gain, and guidance given three months ago for growth in the 9% to 11% range.

The company's weakness continues to be its domestic wholesale channel, where sales declined 13% to $880 million, while direct-to-consumer sales rose 15%. International sales did well, gaining 35% over last year, but those still only comprise 22% of total sales. Revenue from apparel decreased 8%, while footwear increased 2% and accessories were up 1%. 

Founder and CEO Kevin Plank was clearly not pleased with the results. "While our international business continues to deliver against our ambition of building a global brand, operational challenges and lower demand in North America resulted in third quarter revenue that was below our expectations," he said in the press release. 

Under Armour has struggled all year due to softening domestic demand for athletic wear and strong competition, especially from Adidas AG, which reported a 23% gain in North American sales recently and raised its outlook for the year. In a conference call laden with sports analogies, Plank and his team promised an increased focus on winning in all areas of the business, and an acceleration of cost-cutting efforts.

Trex constructs an excellent quarter

The shares of Trex, a maker of composite decking materials, soared 26% after the company reported sales and earnings that were far above what observers were expecting. Sales were up 32% to a record $140 million, and earnings per share came in at $0.68, a 162% increase over last year's $0.26 per share. Three months ago, the company had guided for sales of $126 million in Q3, and analysts were expecting EPS of $0.55. 

Residential sales increased 23%, and commercial sales, which come from an acquisition completed in the quarter, contributed $9 million to the top line in August and September. Gross margin also improved by 1.9 percentage points to 39.4%. Trex is now guiding to full year revenue growth of 17%.

The company is upbeat about consumer spending for home improvements. "Recent forecasts point to continued positive trends in consumer confidence and in the repair and remodel market, two key indicators of the strength of our residential business," said CEO James E. Cline in the press release.

Trex stock has been on a roll since early 2016, and with Tuesday's gain, is up 69% so far this year. Market tailwinds, good execution, and a savvy acquisition came together to produce another good quarter for the company, and investors seem to believe there are more such quarters to come.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.