Whenever I get the short-term market-beating blues, as my portfolio slumps below the market's average rate of return, charts like this remind me that the market makes no sense. Over the long term, research and reasoning prevail.

The chart plots the stock-price gains of five companies over the past year: Valero (NYSE:VLO), Sunoco (NYSE:SUN), ConocoPhillips (NYSE:COP), ExxonMobil (NYSE:XOM), and BP (NYSE:BP). As you can see, their ups and downs move in lockstep, but at different amplitudes. Why the synchronicity? Each company is involved in the oil industry, subject to volatile prices and cyclical demand. Their varying amplitudes result from their market capitalization and popularity -- in other words, reasons that make no analytic sense.

Investing is about buying shares of a company -- not a stock, not a sector, and certainly not momentum. Despite their oil involvement, Valero, Sunoco, ConocoPhillips, Exxon, and BP are hardly identical. They obviously operate differently, excel in different market segments, and have very different fundamentals. Yet the market treats them all the same!

The difference is only one of intensity. If the market had valued these stocks only according to market cap, Exxon, at $370 billion, would have gained the least. BP, with $220 billion, would be next, followed by ConocoPhillips ($77 billion), Valero ($19 billion), and Sunoco ($7 billion).

BP is a foreign stock, which may explain why it's more ignored than the others. Valero, which was once valued much lower, caught one of the market's waves last year and has been riding it upward ever since. Otherwise, this chart shows an illogical inverse relationship between market cap and performance. That's the market for you. Sigh.

But the market's lack of logic is as much a long-term help as a short-term hindrance. I own shares of Valero and keep a close watch on the stock. When it drops, I get all of my research out again and reevaluate the company's prospects. I question whether the drop exposed a flaw in the company or a fundamental change in my buying thesis. From April to May, Valero slid from $80 per share all the way down to $60. On reassessment, I found that I still valued the company at approximately $110 per share -- so I bought more stock. The market has since reassessed Valero too, and the stock is trading close to $80 again.

Examples like this one are my response to anyone who claims that the market is efficient. With so many lemmings out there, that's just not the case.

The Motley Fool Inside Value newsletter finds the market's inefficiencies and exploits them for maximum gain. Learn more by taking a 30-day, no-obligation free trial.

Tim Hanson owns shares of Valero but no other company mentioned. At the Motley Fool, no writer is too cool for disclosure ... and Tim's pretty darn cool.