The market's fortunes caught a break last week as the Nasdaq Composite jumped nearly 7%, taking a good-sized bite out of the 20% pullback suffered over the course of the previous seven weeks. And for a couple of Nasdaq-listed names, things have been even better. Not only did they outpace last week's market-wide gains, but both of these stocks have managed to shrug off weeks of headwinds and are now well up for the year.

This raw strength has captured the attention of lots of investors, of course, but merits a closer look from you as well. Here's a closer look at both stocks and why they are bucking the trend.

Rising bar chart with an arrowed trend line.

Image source: Getty Images.

Winner winner chicken dinners

Shares of Dollar Tree (DLTR -0.28%) and United Therapeutics (UTHR -1.63%) beat the daylights out of the broad market last week, rallying 29% and 25%, respectively. This bullishness isn't exactly unusual for these two tickers either. While the Nasdaq itself is down 22.8% year to date, United Therapeutics is up 6.6% for the year, and higher by 37% for the past three months. Meanwhile, Dollar Tree shares are 14.2% higher than where they ended 2021.

For Dollar Tree, investors are celebrating the fact that the inflation bug has not seemingly bitten the retailer like it has many of its rivals (including Walmart). In fact, it appears to be benefiting the discounter. The company -- which is also parent company to Family Dollar stores -- turned $6.9 billion in revenue into per-share earnings of $2.31 during the three-month stretch ending in April, up and 6.5% and 48%, respectively.

Better still, those results topped consensus sales estimates of $6.76 billion and for a bottom line of $2 per share. Same-store sales were up 4.4%. The company's previously released 2022 operating profit guidance of between $7.60 and $8 per share was also reaffirmed as part of Dollar Tree's quarterly report. For perspective, Dollar Tree earned $5.80 per share in 2021.

In short, higher prices aren't causing consumers to tighten their purse strings -- at least not yet. Inflation is, however, prompting people to shop where they're getting the most bang for their buck.

As for United Therapeutics, most of its recent bullishness can be attributed to last week's FDA approval of its inhalation powder treprostinil for the treatment of pulmonary arterial hypertension. Treprostinil, which will be marketed as Tyvaso DPI, will compete with Liquidia's injectable version of the now-generic drug for a piece of the pulmonary arterial hypertension market that's estimated to be worth on the order of $5 billion per year now, according to Global Market Insights, but could be worth closer to $10 billion within the next five years.

Although last week's announcement that the FDA is green-lighting treprostinil clearly boosted the stock, note that United Therapeutics' shares have been climbing for the better part of the past couple of years as investors have been pricing in increasingly compelling odds of such an approval.

Be patient, but not stingy

It's tricky. Most investors innately know a stock's past performance is no guarantee of future results. And in this case, there's a strong argument to be made that any potential bullishness has already been used up; there may or may not be any upside left to tap.

Take a step back and look at both bigger pictures again in their entirety, though. While it is true that both of these stocks may be a bit overbought and ripe for a little profit-taking in the very near term, both companies now sport attractive fundamentals in their own way. Dollar Tree is taming the inflation beast that's proven problematic for so many other retailers, while already-profitable biopharma outfit United Therapeutics now has another revenue-bearing product to add to its portfolio. Any decent pullback from either stock is a buying opportunity for investors who are on the fence with either name.

Just don't wait too long if you're holding out for a lower price. At less than 13 times its trailing earnings, United Therapeutics is already bargain-priced, and Dollar Tree shares aren't exactly expensive, trading at less than 20 times this year's expected profits.