Nvidia (NVDA -1.99%) has been one of the best stocks to own over the past few years. Not only has it gone up nearly 200% this year, but it has also been a huge long-term performer in the market.  Since 2020, Nvidia is up over 600%, turning every $1,000 invested into over $7,000. Those are some explosive returns for a company the size of Nvidia.

But are these gains sustainable? And what can current and prospective shareholders expect moving forward? Let's find out.

GPUs can be utilized for many tasks

Nvidia's business focuses on one piece of crucial computing hardware: the graphics processing unit (GPU). Led by current CEO and founder Jensen Huang, Nvidia invented the GPU in 1999, which made real-time programmable shading possible for gaming graphics.

However, the biggest leap forward was parallel computing, a principle that GPUs run on. This made GPUs the ideal product for anything computation intensive. As a result, GPUs are now utilized in any process where heavy calculations, like engineering simulations, cryptocurrency mining, or training artificial intelligence (AI) models, are required.

The latter use case has given Nvidia's stock a recent boost as the company's stock has surged nearly 40% since it gave guidance that revenue will rise 64% in the second quarter of fiscal 2024 thanks to increased AI chip demand. But Nvidia's performance has come at a steep price as the company may have outrun its business results.

Nvidia's stock is very expensive

Because Nvidia is a tech hardware company, it can be subject to the rise and fall of demand cycles. The latest fall came when the cryptocurrency market fell apart last summer, destroying demand for Nvidia's gaming-centric chips (gaming chips are the variety used to mine cryptocurrency). Revenue from that division is down 38% year over year, but it is up 22% quarter over quarter, showing some recovery.

But due to this demand evaporation, Nvidia was over-employed, causing its margins to take a beating over the past year.

NVDA Profit Margin (Quarterly) Chart

NVDA Profit Margin (Quarterly) data by YCharts

However, Nvidia has rightsized some divisions and, combined with new demand, has seen its margins significantly improve after a few bad quarters. As a result, using the trailing price-to-earnings (P/E) ratio to value the stock would not be useful as it includes a period when Nvidia wasn't optimized for profits. Otherwise, investors would be staring a P/E of 221 in the face, which is way too expensive for nearly any stock.

Instead, you can utilize a price-to-sales ratio or a forward price-to-earnings ratio (which uses analyst projections) to understand where Nvidia is trading now in relation to historical points. From a P/S ratio standpoint, Nvidia is still an incredibly expensive stock.

NVDA PS Ratio Chart

NVDA PS Ratio data by YCharts

Even if you look at its forward P/S ratio, the stock trades well above its normal valuation ranges. Additionally, few stocks have managed to maintain a P/S ratio of 40 as they either grow revenue to reduce the valuation or their stock price falls off a cliff to reduce the numerator portion of the ratio.

Forward earnings tell a similar story as 54 times earnings isn't a cheap price tag either.

NVDA PE Ratio (Forward) Chart

NVDA PE Ratio (Forward) data by YCharts

With Nvidia trading at forward levels that would be considered expensive for trailing levels, the stock is priced for utmost perfection. Nvidia must deliver a knockout quarter in Q2 to maintain its ultra-premium price tag. Even if it reports another quarter with blowout earnings, the stock may not see much movement because perfection is expected at this price.

So what should shareholders do? Nvidia's best-in-class products are required to build the best AI models and power data centers. This will always keep the demand for Nvidia's products high, but the company has already displayed how it can get wrapped up in hype cycles (like with cryptocurrency) and struggle for a few years.

Because of that, I think it's wise for investors to take some gains here as there isn't a ton of upside left. However, outright selling the position may not be the best move either as Nvidia may surprise us all with even greater third-quarter guidance (just like it did with Q2 guidance).

Nvidia is a leading company, but its stock is so expensive that it makes a reasonable analysis difficult.