Shares of home improvement retailer Home Depot (HD 1.25%) were up over 40% in 2017, thanks to an impressive surge during the final third of the year. Several factors converged to lead to the impressive run, and a repeat performance may not be in the cards. While that doesn't necessarily mean investors should pass on the stock, some caution is in order.

HD Chart

Data by YCharts.

What happened last year

Home improvement stores had a great 2017 thanks to strong consumer spending. According to the U.S. Census Bureau, total retail through the end of November had risen 4.4% compared with 2016.

Building materials and gardening equipment, the Census Bureau segment that Home Depot and other home improvement retailers fall under, was one of the best-performing sectors. Sales increased 8.2% through November compared with the prior year.

Part of the big boost for home supply purchases was the result of tragedy. 2017 will go down as a record year for hurricane activity in America, with Irma and Harvey wreaking havoc in the southeast U.S. and Caribbean. There were also fires in California, destroying homes and businesses and displacing thousands. That destruction temporarily boosted demand for building supplies during the third quarter. Home Depot reported an extra $282 million in sales during the summer months as a result.

Through the first three quarters of its fiscal year (the fourth hasn't been reported yet), Home Depot's revenue and earnings per share increased 6.4% and 15.2%, respectively.

The front door of a Home Depot viewed from the parking lot. A customer is pushing a cart through the front door.

Image source: Home Depot.

Hitting another home run

Can the home improvement store put together another record performance without the help of natural disasters?

The answer could be yes. The U.S. economy has been slowly but steadily improving for a decade now, and indications point to that trend continuing in the year ahead. The recent tax reform will put money back into many families' pockets, too, likely another tailwind for consumer spending. When the economy improves, housing and construction tend to do well and that bodes well for Home Depot.

However, after a strong year where everything was going Home Depot's way and shares rising so much, the stock is a little pricey for my preference. The trailing-12-month price-to-earnings ratio currently sits at 26.3, implying a great deal of growth is still ahead. The forward P/E based on expected earnings is at 22.5, not exactly the explosive upside warranting a premium price. This is a home improvement retailer, after all, a business model that has been around for a long time.

Price to free cash flow, a more accurate reading on how profitable a company is, doesn't give a very different reading; it currently stands at 23.5 for Home Depot. Paying for over 20 years' worth of profits is a little rich for my taste for a home improvement store.

HD Price to Free Cash Flow (TTM) Chart

Data by YCharts.

Of course, the company could beat all expectations and continue its historic rise. Home Depot has a solid track record of growing its business over time, but it's worth bearing in mind that growth in housing and home improvement are the story here. Barring another big surge from consumers or some other one-time event, I worry that some of last year's momentum will run out. I'm sitting on the sidelines for the moment.