Amazon (AMZN -0.87%) spent 2022 in the doldrums. But investors who held on during those tough times should be happy about their decision now. The e-commerce and cloud computing giant has made progress along the path to recovery with improvements in net income and operating income in the most recent quarter. And its shares have climbed more than 50% since the start of the year.

Those who use technical analysis as an investment tool also may be optimistic about Amazon these days. That's because the stock recently showed a pattern that indicates a bullish phase. Does this make Amazon a buy?

Economic headwinds

First, a quick summary of Amazon's recent past. Economic headwinds like inflation and internal challenges -- such as excess capacity across its fulfillment network -- have weighed on earnings. In fact, last year Amazon reported its first annual loss since 2014.

But management took quick action -- and the effort is paying off today. The company improved its cost structure, which should help it excel both in difficult times and in easier market environments. It cut jobs, focused investment on its highest-growth areas, and even made changes to its way of fulfilling orders in the U.S. It switched from a national model to a regional model. This should cut costs and delivery times.

In Amazon's most recent earnings period, operating income climbed; it reported net income instead of a loss; and the company greatly reduced its outflow of cash. So management's plan is bearing fruit.

And that's why it's no surprise that, as the broader market began to rally this year, so did Amazon.

Now, let's take a look at the technical analysis pattern I mentioned earlier. It's called a golden cross, and Amazon entered this pattern about a month ago. This involves a stock's short-term moving average crossing over a longer-term moving average.

Analysts confirm the bullish trend has arrived if the stock price continues to rise, keeping the shorter-term moving average above the longer-term one.

AMZN 50-Day Simple Moving Average Chart

AMZN 50-Day Simple Moving Average data by YCharts.

As we can see in the case of Amazon, so far, so good.

Time to buy?

Now let's get back to our question. Does this bullish sign mean it's time to buy Amazon? I consider Amazon a great long-term buy right now but not because of the golden cross pattern. Here's why. Technical analysis relies on short-term price movement and market sentiment, which can change any time for any reason. That's why investing for the short term is a gamble. Any benefit you get from reading a chart today won't impact your returns by very much over a period of years.

But business performance will. And that's why I favor looking at the strength of a company's earnings, and its market position and prospects down the road. In the case of Amazon, it just so happens that all of these elements are looking good. But that was the case well before Amazon's stock showed the golden cross pattern.

By using the percent change formula, we can see that investors who bought Amazon shares 10 years ago and held on are winning. The stock has advanced more than 800% in that time period.

There's no guarantee Amazon will climb that much in the coming decade. But it's fair to say the company has what it takes to advance significantly. It's a leader in two markets that are growing by double-digit percentages annually: e-commerce and cloud computing. And it has the infrastructure and resources to stay on top in those areas. For example, in cloud computing, Amazon has put a focus on the high-growth market of artificial intelligence.

All of this means that, while technical analysis is interesting, it wouldn't prompt me to buy or sell. But a close look at Amazon's long-term prospects would make me a buyer of this market leader.