Warren Buffett bet on the wrong tech company

Warren Buffett told CNBC today that he sold about one-third of his IBM shares.

The company was a large position for Berkshire since he started purchasing shares early in 2011. His adjusted cost isn't known but he started out by buying nearly $11 billion starting in March and peaking in Q3.

He later increased his position.

The trade was in the money for a couple years but it's been a dog since 2013. Last year it fell as low as $120.

His cost is $170.43 and it was his fifth-largest holding after Wells Fargo, Kraft-Heinz, Coca-Cola and Apple.

Today Buffett revealed he was selling and had sold about one-third of the position.

"I don't value IBM the same way that I did 6 years ago when I started buying... I've revalued it somewhat downward," Buffett told CNBC. "When it got above $180 we actually sold a reasonable amount of stock."

So he made some money on the sale of the one-third -- around $10 per share plus the dividends he earned. But with shares now trading at $154, his net position is back in the red.

What makes it especially painful is that the S&P 500 is up nearly 100% since he announced the purchase.

The trade is a reminder that even the best make mistakes. It's also a lesson trading out of a position. Buffett surely felt like capitulating last year at $120 but the company still had an attractive yield at that point so he was able to hang in there and minimize his losses.