Stocks have been on fire over the past few days -- and for good reason. A move by the U.S. and China has helped companies and the overall economy avert a huge problem. The countries, which were involved in a trade war, struck an initial deal on import tariffs -- one that was better than what most analysts expected.

As a result, the major benchmarks surged, with the S&P 500 (^GSPC 0.41%) moving into positive territory for the year as of the May 13 market close, and the Nasdaq Composite (^IXIC -0.18%) climbing 24% since its April low. For an index to enter a new bull market, it must advance more than 20% from its recent low and reach a new record high -- so a Nasdaq bull market may be on the way.

Let's check out three things every investor should do before it arrives.

An image of a bull in gold.

Image source: Getty Images.

1. Focus on long-term possibilities -- not short-term profit

With indexes and individual stocks surging, it might be tempting to sell shares and lock in a quick profit. For example, high-growth stocks Nvidia (NVDA -0.52%) and Tesla each soared in the double-digits over the past few days following the agreement reached by the U.S. and China -- meaning a sell now could equal profit for some investors. These players were among the big decliners in recent months amid concern that a high-tariff environment would weigh on their earnings prospects.

And, of course, many other stocks experienced the same pattern -- deep declines last month and a sharp recovery over the past few days. If you hold shares of these companies, you might consider selling and locking in a profit -- but before you do, it's important to consider each company's long-term potential.

I'll use Nvidia as an example. Yes, the shares have climbed in the triple digits over the past three years, but the company dominates the artificial intelligence (AI) chip market, is likely to maintain this position thanks to its strong focus on innovation, and the AI growth story is in its early stages. So Nvidia could continue to deliver gains for quite some time.

This doesn't mean you shouldn't reduce any positions. It just means that, before you do, consider each company's prospects over the years to come. A double-digit gain today is great -- but certain players could deliver much more over the long run.

2. Continue bargain hunting

Stocks are soaring, which means valuations also are heading higher. We can see this in the S&P 500 Shiller CAPE ratio, a measure of stock prices and earnings over a 10-year period -- to allow for shifts in the economy. This indicator reached highs earlier in the year, then started to decline, and now, as you can see in the chart, it's on the rise again.

S&P 500 Shiller CAPE Ratio Chart

S&P 500 Shiller CAPE Ratio data by YCharts

It's important to note that the market as a whole, even after recent declines, hasn't reached "cheap" territory. The S&P 500 Shiller CAPE ratio of 34 is a high level, only surpassed twice over the past decade.

S&P 500 Shiller CAPE Ratio Chart

S&P 500 Shiller CAPE Ratio data by YCharts

But, even in this context and as stocks rise, you still can find bargains -- especially among stocks that suffered the most earlier in the year. Many tech stocks are very reasonably priced today, and a good example is Alphabet (GOOG -0.94%) (GOOGL -0.92%), which at a forward price-to-earnings ratio of 16 is the cheapest of the "Magnificent Seven" stocks.

So, as stocks rise, continue looking for bargains -- you can find them during any market environment.

3. Set aside cash for opportunities

Finally, considering this idea that bargains may be found in both bear and bull markets, now is the perfect time to evaluate your cash position. Stocks are on the rise, and as a whole may be getting more expensive, but as mentioned, this doesn't mean every stock is pricey and opportunities are disappearing. That's why it's important to maintain some cash to deploy when the time is right.

So, if all of your bills are paid and you can set aside cash -- whether it's a few dollars or a large sum -- do that. When the Nasdaq bull market arrives, you'll be prepared for any opportunity that arises -- and can seize it at the right moment.