If you're tempted to listen to investing experts on TV when they recommend getting in or out of the market, think twice.

Many financial prognosticators like to predict when the market will surge and when it will crash. Unfortunately, they're often wrong. No one can consistently and accurately know what the market will do in the short term. In the long term, though, the trend is clear: The market tends to rise.

Shedding some very useful light on the question is a study conducted by University of Michigan finance professor H. Nejat Seyhun for Towneley Capital Management. Here are some of his findings:

If you invested in the stock market from 1963 through 1993, it would have yielded an average annual return of 11.83%. That should seem pretty good.

But, here's the amazing part. The period of 1963 through 1993 includes 7,802 days. If you were out of the market (not invested in it) for the 10 days when the market rose the most, your average annual return would only be 10.17%. If you sat out the 30 best days, your return would plunge to 8%. Up that to the 90 best days, and you're down to a mere 3.28%.

Most of the market's gains seem to occur on just a few days. This means anyone who tries to time the market is at risk of missing out on substantial gains. While some will suggest that there are dangerous times to be in the market, it's probably more dangerous to be out of it.

In 1995, the market (as measured by the S&P 500) advanced a whopping 37.5%. Some prognosticators suggested that 1996 would give back some of that gain. Had you sat out 1996, you'd have missed out on a rise of just under 23%. In 1997, the S&P advanced 33%. Considering that the market's historical average return is 11%, those were heady years. Many predicted that we were surely due for a crash. Yet 1998 offered a jump of 28.6%. You just never know.

The lesson is clear: if you hang on for the long term, you'll be in the market on days when it counts -- and able to ride out the occasional downturns.

Here are some more Fool articles touching on this topic:

To learn more about investing Foolishly, visit our Fool School and our Investing Basics area. Or check out some of our inexpensive and well-regarded online how-to guides (which feature money-back guarantees).

By the way, if you'd like to receive several promising stock ideas delivered via email each month, learn more about our suite of investment newsletters (which are offered along with some free research reports).