You'll often hear us value-oriented investors telling you that long-term investing is best and short-term volatility is meaningless. Berkshire Hathaway's (NYSE: BRK-A) (NYSE: BRK-B) Warren Buffett has said he prefers to invest as if the stock markets were going to shut down for years. His favorite holding period? Forever.

These value-oriented philosophies are sound, and I agree with them. Yet investing is not a rigid science. Always seeking to buy low and sell high will help you maximize your profits, but even the best investing principles can sometimes take a back seat to short-term market fluctuations. The crucial factor in those cases is to let Mr. Market's erratic moods serve you and not guide you.

Let the market serve you
When a company faces financial trouble and needs to raise capital just to survive, short-term price volatility hurts. Investors with no say in the matter will find their investments diluted, often to an unfavorable price.

The most glaring contemporary example is the financial sector. Countrywide Financial (NYSE: CFC) once commanded a market valuation of nearly $25 billion, but then the mortgage crisis hit, and Countrywide found itself in the eye of the storm. To help alleviate the pain, Bank of America injected an initial $2 billion into Countrywide, after it had fallen about 40% from its market high. Desperate for additional capital as the mortgage and securitization markets continued to deteriorate, Countrywide eventually accepted a $4 billion takeover offer from Bank of America. The deal represented about $7.16 per Countrywide share, versus its recent all-time high of $42. But investors in Countrywide had no choice but to take the deal. It was either go with Bank of America, hope for some other white knight, or face losing their investments entirely if the company were to go bankrupt.

The brighter side
Short-term volatility isn't always bad, especially if investors are patient and strike at the right time. During the height of the dot-com bubble, for example, investors who weren't blinded by excessive greed could have taken advantage of Mr. Market's generous mood on certain stocks. In 1999, Microsoft (Nasdaq: MSFT) shares traded for between $34 and $60, accounting for all stock splits. Assuming you didn't sell at the bottom or top, you probably would have sold shares at an average of 50% higher than today's price of $28. Similar selling opportunities presented themselves with Yahoo! (Nasdaq: YHOO) -- which was never profitable enough to justify its 1999 price of more than $100 a share -- and a host of other tech companies, as the market offered an environment in which a rising tide lifted all boats.

Hindsight is 20-20, of course, but it would've been best to take your gains and run when Microsoft -- or any company, for that matter -- was trading at nearly 50 times earnings in 1999.

On the flip side, investors with the conviction to buy during periods of extreme pessimism can also benefit magnificently from short-term price fluctuations. Anybody who swooped in on Jan. 22, when the Dow opened with nearly a 500-point drop, can attest to the wisdom of that approach. The Dow made up most of the decline on that day alone, and since then, the Dow has risen by 6%.

Price is what you pay. Value is what you get.
If you keep buying at cheap, attractive prices, you can take comfort in knowing that whatever the market does in the short term, Mr. Market won't take advantage of you with its temporary fluctuations. Ultimately, you will be taking advantage of Mr. Market.

Forever-wise Foolishness:

Berkshire Hathaway is a recommendation of both Stock Advisor and Inside Value. Microsoft is an Inside Value recommendation. Bank of America is an Income Investor pick. Yahoo! is a former Stock Advisor selection. You can try any of these market-beating services free for 30 days.

Fool contributor Sham Gad is the managing partner of the Gad Partners Fund, a value-centric investment partnership operating in similar fashion to the 1950s Buffett Partnerships. He and the Fool have a stake in Berkshire Hathaway. The Fool has a disclosure policy.