If you're uneasy about the market's foreseeable future, you're not alone. The rebound effort that's been underway since mid-June has been tentative at best. And this week's warning from Walmart about its second-quarter earnings, in addition to IBM's currency-prompted caution, could further rattle already-wobbly stocks. It's an inauspicious start to earnings season.

But before bailing out of stocks in an effort to steer clear of any renewed bearishness, wait. As much downside risk as there seems to be ahead, there's at least as much risk of missing out on important upside.

The little things add up

After tumbling a total of 24% between January's high and last month's low, the S&P 500's (^GSPC 0.80%) 7% rebound in the meantime feels like a gift: a chance to get out with smaller losses than most of us were nursing just a few weeks back. The chance of more downside feels palpable, too, particularly given that summer is usually a slow, bearish time of year for stocks. Rekindled worries of a full-blown recession only bolster the bearish case.

There's a funny quirk you need to understand about the market, though: It's not always backward-looking. Sometimes it's forward-thinking, pricing in renewed economic growth that isn't always easy to see, or perhaps hasn't even materialized yet. And more than that, some of the biggest forward-thinking gains take shape when you least expect them to. The effort to steer clear of the market's setbacks can often leave you out of those moves.

Mutual fund company Hartford dug through mountains of data to find some eye-opening truths about the market's biggest daily gains. Over the past couple of decades, about half of them took shape in the midst of bear markets.

That doesn't necessarily prevent you from suffering setbacks in the days immediately before and after those big winners. Given that nobody sees these rallies coming, though, it does show that trying to sidestep downside could end up costing you -- particularly if you're hopping in and out of stocks while on the way down.

And the cost can be higher than you might ever expect.

Numbers crunched by stock speculator Peter Tuchman -- a trader on the floor of the NYSE who is one of its most-photographed participants -- indicate that between 2000 and 2019, missing the market's 10 biggest daily gains would have cut your annual returns by about half relative to simply remaining invested during that stretch. Missing out on the best 20 days would wind your returns back to almost nil.

There's an upside to steering clear of the market's worst daily performance, of course. Just avoiding the 20 worst days during that 20-year stretch would have more than doubled your returns from simply buying and holding.Again though, if you want to capture all of that upside while also avoiding the market's major downside moves, your timing has to be perfect. And nobody's is.

Research done by brokerage firm Edward Jones will help you use a stick-with-it, leave-it-alone approach. The company has found that of the past five transitions from a bear market to a bull market, the S&P 500 rallied an average of 25% in the first three months following the day the pivot, or bottom, was reached.

The moral of the story? Just stand pat, take your occasional lumps, and trust that in time your patience will pay off. If your market timing isn't absolutely perfect all the time, the odds are still stacked dramatically against you.

The real danger is in missing out

In answer to the headline's question, it's safer to keep investing right now than it is to pull your money out of the market -- but  not for the reason you might think. Sticking with stocks is the safer play at this time because the real danger is missing out on gains nobody sees coming.

Have confidence that time (and not even that much time) will take care of your bottom line, even in the current environment where it feels like the misery might never end. Eventually, it always does.