What happened

Shares of Western Digital (NASDAQ:WDC) gained 13.3% in July, according to data from S&P Global Market Intelligence.

The stock climbed early in the month, thanks to a bullish run for the broader stock market. It also benefited from continued momentum based on signs that supply glut may become less of an issue for NAND flash memory-chip companies.

WDC Chart

WDC data by YCharts.

The NAND flash memory-chip market has seen prices depressed by an abundance of inventory: The global market for phones and computers has slowed, and potential growth catalysts like connected cars have seen slower-than-expected sales due to a downturn for the broader auto market. This has caused memory-chip companies to reduce their overall chip output and capital expenditures.

Also, a factory outage in June, at a Toshiba plant that manufactures NAND for Western Digital, appears to have been interpreted as a positive event for the broader industry -- and translated into more bullish sentiment for its key players.

A small glass globe on top of papers displaying graphs and charts

Image source: Getty Images.

So what

In addition to June's factory outage resulting in a substantial reduction in Western Digital's expected NAND production for the year, the company's stock also seems to have benefited from its competitor Micron Technology posting better-than-expected third-quarter results. With the broader market posting gains in the month and some indications that the cyclical NAND market may have reached a bottom, investors saw more promise in Western Digital stock ahead of its fourth-quarter earnings release on July 31.

Now what

Sales for Western Digital's fourth quarter fell 29% year over year to come in at roughly $3.63 billion, with a net loss of $197 million (or $0.63 per share) and a non-GAAP (adjusted) net income of $50 million -- or $0.17 per share.

For the first quarter, the company expects revenue to come in between $3.8 billion and $4 billion, with a non-GAAP gross margin between 24% and 25%. Management is guiding for first-quarter adjusted earnings per share to come in between $0.15 and $0.30. The company also stated that it believes that the memory-chip market has already hit its cyclical low point and is on the path to bouncing back, but its shares haves lost ground this month.

Western Digital stock has dipped roughly 6% in August's trading amid sell-offs for the broader market, stemming in part from another turn for the worst in the ongoing trade disputes between the U.S. and China. Shares now trade at roughly 18.5 times this year's expected earnings.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.