Investors were gobbling up stocks last week, and that was enough to lift more than 530 companies trading on the three major U.S. exchanges to new 52-week highs. If you want a piece of the market's top stocks, a good place to start is with the ones hitting new high-water marks. Some of the winners make sense, but others may come as a surprise. 

Ambarella (NASDAQ:AMBA)AT&T (NYSE:T), and Trex (NYSE:TREX) are three of the names hitting their highest stock price levels in more than a year. Let's dive in to see what's driving the winning streaks at the three market winners.

A Trex deck and railing with a colorful chair and bicycle.

Image source: Trex.

Ambarella 

There was a time when it seemed as if Ambarella could do no wrong. The provider of low-power, high-def video compression and image processing solutions was riding some of the hottest trends in the tech universe, cashing in on the popularity of GoPro (NASDAQ:GPRO), drones, home surveillance gear, and just about anything that needed a camera. We then saw a few of those trends fade, and Ambarella paid the price. 

This is now the fourth year in a row in which revenue is declining at Ambarella, but investors are getting optimistic. Ambarella announced earlier this month that it expects to finally post year-over-year growth on its top line for the current quarter. It has another hot trend it's riding these days -- computer vision -- and the stock is at its highest point in nearly three years.

AT&T 

The giant wireless carrier may seem like an odd fit to be cracking through the ceiling of its 52-week trading range. It continues to shed DIRECTV subscribers. The Time Warner deal has helped provide some solid content and revenue diversification, but it may seem like a distraction as AT&T itself continues to struggle outside its mobile business. 

But everything changes when activists are at the door. The stock moved higher after Eliot Management, armed with a $3.2 billion stake in AT&T, put out a plan for change at the wireless giant. Eliot Management is calling AT&T out for some of its biggest acquisitions and general mismanagement, and it's urging AT&T to make sure it leads the charge in the 5G movement. 

Trex

Summer's coming to a close, and with it the outdoor season that Trex lives for. Trex is the top dog when it comes wood-alternative decking, a market that may not seem like a hot niche, with the economy getting iffy and the housing market feeling as if it's topping out. You don't want to invest in expanding your home's living space if you think real estate prices are moving lower. 

Trex comforted investors this summer when it followed up in-line quarterly results with an upbeat outlook for the current quarter. The $205 million to $210 million Trex is targeting for the third quarter would be 25% revenue growth at the midpoint, its headiest top-line burst in more than a year. The current quarter should also end the streak of four consecutive quarters of decelerating revenue growth, a pretty important thing since its top-line results were flat last time out.