In a time of market turbulence, with stocks losing altitude, it’s only natural to feel compelled to buy and sell according to your own forecasts of whether a stock — or the market as a whole — will rise or fall in the short term. My advice: Resist!

Unfortunately, the urge is strong — almost irresistible. It looks easy in hindsight, and the results are spectacular. Let’s pick a stock at random: Waters, a midsize manufacturer of high-tech equipment, such as liquid chromatography systems. Waters is not an especially volatile stock, yet in nine of the 12 years starting in 2000, its yearly high has been at least 50 percent higher than its low. In 2000, you could have bought 1,000 shares at $22, sold them in 2001 for $85, bought them back again in 2003 for $20 and sold them in 2011 for $100. Total gain: $143,000. But if you had bought the stock at the start of 2000 and held it continuously through Sept. 9, 2011, when the shares closed at $75, you would have earned just $53,000.

Or consider the U.S. market, as represented by SPDR S&P 500, the popular exchange-traded fund that tracks the Standard & Poor’s 500-stock index. If you had $10,000 in Spiders at the start of 2001, you would have had $11,519, including reinvested dividends, at the end of 2010. But if you had pulled your money out at the start of 2001, 2002 and 2008 — all down years for stocks — stuck the cash under the mattress, then reinvested the money at the start of the years that produced gains, you would have had $26,316.

Efficient-market hypothesis

Market timing — the term for the process of moving in and out of assets according to predictions of what their prices will do next — looks like it can be a hugely successful strategy. So might the strategy of guessing the numbered slot into which a roulette ball will fall after the wheel is spun. The only problem is that most mortals can’t time the markets consistently well enough to make the strategy worthwhile. And because of the vagaries of human emotions, the act of trying to time the stock market often produces far worse results than just buying a diversified bundle of stocks and holding them for the long haul. People tend to sell in a panic at the bottom and buy in a flush of confidence at the top.

John Bogle, founder of the Vanguard Group of mutual funds, wrote of market timing: “After nearly 50 years in this business, I do not know of anybody who has done it successfully and consistently. I don’t even know of anybody who knows anybody who has done it successfully and consistently.”

The reason is that markets are efficient. University of Chicago economist Eugene Fama first formulated the efficient-market hypothesis in his PhD thesis: “In an efficient market, competition among the many intelligent participants leads to a situation where, at any point in time, actual prices of individual securities reflect the effects of information based both on events that have already occurred and on events which, as of now, the market expects to take place in the future. In other words, in an efficient market at any point in time the actual price of a security will be a good estimate of its intrinsic value.”

Put it another way, a stock’s price represents the consensus judgment based on all the knowledge that can be gleaned about the underlying company at that moment. Tomorrow’s price is unknown and unknowable. Because of the EMH, economist Burton Malkiel of Princeton wrote that “a blindfolded chimpanzee throwing darts at the Wall Street Journal can select a portfolio that performs as well as those managed by the experts.”

The EMH is actually liberating. It implies that you don’t have to spend your time trying to guess the short-term movement of a stock, because you can’t predict it any better than anyone else.

So is this a good time to buy shares of Waters? It is as good a time as any if you believe the EMH because the price of Waters reflects everything that could possibly be known. The rest is mystery. As a result, the best stock-buying strategy is to find great companies, buy them now and hold them for a long time.

Luck or genius?

But can’t some geniuses, such as Warren Buffett, beat the market by buying and selling stocks (or whole companies) at the right time? The jury is still out. The laws of chance predict that some investors will time the market correctly for a while at least. They look smart, but they may just be lucky.

Buffett certainly has a great record. But if you had decided a decade ago to capitalize on his brilliance by investing in the holding company he chairs, Berkshire Hathaway, you would have been dis­appointed. Berkshire outperformed the S&P 500 in six years and trailed it in five years (including 2011, through Sept. 9). Bill Miller, manager of Legg Mason Capital Management Value Fund, beat the S&P every year from 1991 through 2005, but since then his record has been less than stellar. He’s trailed the S&P in five of the past six years (again, including 2011), and, for the 10-year period through Sept. 9, his fund ranks in the bottom 1 percent of its category, according to Morningstar.

Mark Hulbert, whose Hulbert Financial Digest has followed predictions in financial newsletters for 31 years, concludes that “market timing is not impossible but very difficult.” At my request, he went through the 97 newsletters that he tracks and which have been around for at least 10 years and produced a list of those whose timing calls exceeded the 3.7 percent annualized return of the broad Wilshire 5000 index over the past decade. (Hulbert measures a service’s timing calls by assuming that an investor in stocks earns the return of the Wilshire 5000 and that an investor in cash earns the yield of a 90-day Treasury bill.)

Only seven newsletters beat the index, including two edited by Dan Sullivan, one of my longtime favorite newsletter editors. But although Hulbert can point to experts who have beaten the market over some periods, “the question,” he says, “is whether they can do it in subsequent periods.”

If you still can’t fight the urge to try to time the market, do it as little as possible and concentrate on areas in which the EMH has the least effect. Buy stocks in areas where information is harder to come by and fewer analysts are paying attention or where, for some reason, investors are shunning perfectly good com­panies. Three such sectors are developing markets (stocks of companies in places such as China, Brazil and Indonesia), micro caps (too small for most mutual funds to buy) and value stocks (which, by definition, have lower valuations than the market as a whole).

The best time to buy? What about right now?

Glassman is a contributing editor at Kiplinger’s Personal Finance. He is the executive director of the George W. Bush Institute in Dallas.