The Dow Jones Industrial Average and S&P 500 are at record highs right now, and many sectors -- tech in particular -- have seen huge gains as well. But there are some companies that, despite the market's overall rise, still look relatively inexpensive.

IBM (IBM -3.38%) and Ultra Clean Holdings (UCTT -0.76%) are both trading below the average valuations of many of their peers, making each a tempting bargain right now. Let's take a closer look at what's happening with each company and why investors may want to consider adding these stocks to their portfolios.

A sale sign showing varying percentage numbers.

Image source: Getty Images.

IBM's continual discount

IBM's shares have tumbled more than 7% this year, which doesn't sound like all that much until you compare it the tech sector's overall gains of 37%. That share price dip has helped push the company's forward price-to-earnings ratio down to just over 11, far below the tech industry average.

Things haven't been going all that well for IBM, of course. The company's sales have been sliding for five years now as it transitions from its legacy businesses to more promising ones, like artificial intelligence and cloud computing.

IBM's cloud revenue over the past 12 months has reached $15.8 billion, and it jumped 25% year over year in the third quarter alone. IBM may be trailing bigger cloud players like Amazon and Microsoft, but cloud computing still represents a key area of potential growth in the coming years. 

More importantly, IBM believes that its Watson artificial intelligence services (for security, analytics, and other applications) will tap into the cognitive computing market that's expected to be worth $2 trillion by 2025. IBM is still in the process of proving that Watson is the best avenue for companies looking for analytics powered by AI, but if it can get over that hump -- and start earning significant revenue from AI -- then the company's shares could turn around. Add to all of that IBM's impressive 3.9% dividend and investors have a solid bargain and dividend play with IBM's shares.

A rising star at a bargain price

Ultra Clean makes tools for semiconductor equipment, and the company's share price is currently benefiting from an explosion of semiconductor capital spending throughout the chip industry. Ultra Clean's shares are up a staggering 120% this year. You'd think that those gains would mean that the company's shares aren't a bargain right now, but that's not the case.

First, the company's shares are still trading at only 8.4 times Ultra Clean's forward earnings. That's a steal compared to the rest of the tech sector, but the deal gets even sweeter when you consider that the company's share price just dropped by more than 20% in October. That tumble came as Ultra Clean missed analysts' consensus earnings estimate of $0.64 (the company reported $0.62 instead) in the third quarter 2017. The drop represents a chance for investors to grab some shares at a discount. 

Ultra Clean is expecting even more growth in the fourth quarter, with revenue projections of about $245 million and adjusted earnings coming in around $0.60 per share -- both of which would be on par with analysts' consensus estimates.

That could be a good ending to 2017 for Ultra Clean, and would set the company up for what it believes will be a great 2018. The company's CEO, James Scholhamer, said on the third-quarter call that,

"These are exciting times in the semiconductor capital equipment industry and early forecast indicate a very strong start to 2018. We plan to capitalize on strategic growth opportunities, both organic and inorganic that we believe will take UCT to the next level."

Each of these companies comes with its own risks, of course, and IBM in particular still has a long way to go in proving itself as a solid long-term investment again. But investors looking for two stocks that can be picked up at bargain prices should give Ultra Clean and IBM serious consideration right now.