There are some stocks you buy because you believe in the company. There are some you buy for the profit potential.

And then there is Exxon Mobil (XOM) . This is a stock you buy to collect the dividend and then get out as fast as you can.

The world's largest energy company will be going ex-dividend next Tuesday. That means if you want to play a timing strategy you buy the stock by then, which puts you on management's list of who receives the dividend check.

Exxon shares currently trade at around $79. A recent rise in the price of crude has helped its shares eke out a nearly 1% gain so far this year, but the past 52 weeks shows a 14% drop. Still, compared with other oil companies, Exxon has been a relative outperformer compared with the 26% decline over the past year by the Energy Select Sector SPDR (XLE) .

Investing in the company's shares has been a risky bet in this current volatile market. Oil prices, though above $30, are still under pressure. In the case of Exxon, whose stock is priced at almost 29 times the 2016 consensus estimate of $2.71 a share, there seems to be too much optimism about its growth prospects. Exxon's price to earnings multiple is 12 point higher than the S&P 500 index and 10 points higher than one of its big competitorsChevron (CVX) .

As for its dividend, Exxon pays 73 cents a quarter, which puts pressure on its revenue and profits. Unlike others in the sector that have suspended their dividends, Exxon's yield of 3.8% -- almost twice the average 2% yield of stocks on the S&P 500 index -- has been one of the qualities keeping its stock from cratering.

Exxon will send it out its dividend checks on March 10 to shareholders of record Feb. 11. This quarter will mark the fifth straight period Exxon has paid a dividend since raising it from 44 cents six years ago.

But given the high expectations implied by its P/E, holding beyond the dividend payment is still too risky. It's smarter to buy the stock, collect the dividend and get out, especially when Chevron is not only priced more attractively at a P/E of 19 but pays a 5.14% yield, or almost a point and a half higher than Exxon.

This article is commentary by an independent contributor. At the time of publication, the author held no positions in the stocks mentioned.