If you're a stock market investor, chances are your portfolio has been hammered over the past few months.

Few sectors have been spared. Big companies such as Sprint Nextel (NYSE: S), small companies such as VASCO Data Security International (Nasdaq: VDSI), banks such as Citigroup (NYSE: C), insurance companies such as American International Group (NYSE: AIG), and even technology companies such as RealNetworks (Nasdaq: RNWK) have all been taken to the cleaners. The list could go on and on.

Watching a lot of hard-fought gains being wiped out in a matter of days or weeks could turn anyone off the stock market for life. A friend of mine is considering just that. He invested $3,000, and that investment is now worth just over a grand. He's waiting to sell until it reaches $1,500, and then he plans to retire from investing forever.

He's clearly hurting, and he's not the only one. Unfortunately, his hurt comes from more than the vagaries of the market: He has made many mistakes.

Mistake No. 1: Investing in stocks in the first place
My friend was clearly not prepared to invest for at least three to five years, and he wasn't prepared to ride the inevitable ups and downs of the market. With that attitude, he should never have invested in the market. Period.

Mistake No. 2: Focusing on quick and easy profits
My friend invested in the stock market because he saw other people making "easy" money in oil and gas exploration companies such as Petroleum Development (Nasdaq: PETD) and Petrohawk Energy (NYSE: HK), and he thought he could do the same.

Because he was focused on quick and easy profits instead of on investing in strong, profitable companies, he invested in his friend's "hot tip" without knowing a single thing about the company he was investing in. Worse still, he put all his eggs in one basket -- a tiny oil explorer hoping to hit it big in a politically unstable area of Central Africa.

In this unforgiving market, the 67% loss on his original investment is somewhat predictable.

Mistake No. 3: Hoping to get out with just a 50% loss
By hoping to sell out when his current $1,000 investment gets to $1,500, my friend is probably about to compound his original mistake.

What he paid for the shares is now irrelevant. If he honestly thinks the shares will rise 50% from here, he should be buying more shares instead of selling out.

But he's not thinking like that. He's focused on taking a 50% hit on his initial investment and with that, getting out of the stock market for life. But I'd respectfully suggest that his speculative Central African oil explorer is likelier to fall by another 50% or more from today's price. He should sell out now -- before it falls further.

Mistake No. 4: Buying at the top and selling at the bottom
It's the classic new investor error: getting sucked into buying when prices are high because you're afraid of missing out on future profits. My friend was swayed by the profits other people were making instead of being persuaded on the fundamentals.

Conversely, inexperienced investors sell when the share price is at a low point, just wanting to get out to avoid any further pain. Selling when the fundamentals have deteriorated (or weren't there to begin with) is smart; selling when the fundamentals look great but the price has fallen is not.

Mistake No. 5: Getting out of the stock market for life
Stock market investing is a great way to build long-term wealth. To give up on it because of one or two bad experiences is a mistake. Instead, a better course of action for my friend would be to learn from his mistakes, change strategy, and vow to conquer the stock market.

My friend didn't get everything wrong, after all -- the oil sector in general is very attractive, and that's despite oil prices already being at record highs.

Invest more money, not less
I'm trying to help my friend learn about the natural ups and downs of the stock market. I'm also encouraging him to sell out of that highly speculative Central African oil explorer before it's too late.

Persuading him to put his loss behind him and invest more money in the stock market is going to be a challenge. But I'm convinced it's the right move for him, particularly since I know he can afford to keep investing in the market for years to come.

The start of a long-term love affair
To support his investing education, I've signed him up for a free 30-day trial to our Motley Fool Hidden Gems investing service. Not only will it help educate him about the stock market, it concentrates on smaller companies, an area of the market where individual investors have the opportunity to earn phenomenal returns.

If that's not enough for him, one of Hidden Gems' very favorite stocks is a fast-growing oil services company (with strong fundamentals) that should be right up his alley.

If you'd like to join my friend on what should be the start of a long-term love affair with the stock market, click here to join our Hidden Gems community free for 30 days.

Fool contributor Bruce Jackson doesn't own any of the stocks mentioned in this article. Sprint Nextel is a Motley Fool Inside Value recommendation and VASCO is a Stock Advisor recommendation. The Fool's disclosure policy is just lovely.