I've written many times before about the virtues of investing. In fact, I've gone so far as to say that if you fail to invest your money relatively early on in life, you could lose out on countless dollars in potential earnings. That said, there are certain financial milestones you should reach before you start pumping your spare cash into the stock market. Here are a few to check off your list.

1. Build a solid emergency fund

No matter your age, relationship status, or income level, you absolutely need an emergency fund with enough cash to cover three to six months' worth of living expenses. The reason? You never know when you might fall ill, lose your job, or come upon some other situation where you're unable to work or are facing a whopper of an unexpected bill. And if you don't have emergency savings in place, you could easily get forced into debt, thus damaging your finances irreparably.

Charts, pen, calculator, and other elements of an investments review

IMAGE SOURCE: GETTY IMAGES.

Even if you're eager to get started with investing, your emergency fund isn't money you can afford to play around with. The best place for that cash is a risk-free, easily accessible savings account, and not the stock market. Only once you've fully funded your emergency savings should you think about exposing yourself to potential losses.

2. Get a handle on your debt

The average American household carries $5,700 in credit card debt, which can be extremely costly given what many cards charge in interest. And let's not forget student debt, which has already well surpassed the $1 trillion mark nationwide.

No matter what type of debt you're carrying, before you start pumping money into the stock market: Map out a plan for paying off what you owe, and use your spare cash to pay down those debts with interest rates higher than what you're likely to bring home in investment returns.

Of course, without a crystal ball, it's tough to predict just how well your portfolio might perform. But historically, the stock market has delivered roughly a 9% average annual return. If you're planning to invest heavily in stocks, you may want to assume an average yearly 7% return, to be on the safe side.

Now if you owe money on a credit card that charges 20% interest, it's pretty clear that you're better off using your extra cash to pay down that debt, and then putting the rest into stocks. Similarly, if you're facing hefty interest charges for your student loans (say, you borrowed from private lenders who are notorious for imposing higher rates), you'll probably come out ahead by eliminating that debt sooner.

3. Establish your short-term financial goals

Just as you should never put your emergency cash into the stock market, so too should you avoid investing money you expect to need in the near term. That's because you never know when the market might take a dip, and if you don't leave yourself enough time to ride out its ups and downs, you're more likely to take a financial hit.

Before you start investing, make a list of your immediate financial goals, and figure out how much money you'll need to achieve them. Then, save up for those goals, and aim to start investing once they've been met. For example, if you're hoping to buy a home within the next three years, and expect to need $50,000 for a down payment, you're better off sticking that cash in the bank than in stocks.

Here's another way to look at it: As a general rule, you shouldn't put money into stocks if you expect to need, or use, that cash within seven years. Some folks might get even more conservative and say not to invest money unless you're certain you won't need it for 10 years. Feel free to err on whatever side of that spectrum aligns with your tolerance for risk.

Though investing, particularly in stocks, is a great way to grow your wealth, there are certain financial elements you'll need to tackle first before getting in the game. But once you've built your emergency fund, eliminated high-interest debt, and saved for your near-term goals, you shouldn't hesitate to start putting money into the stock market. With any luck, you'll enjoy a nice return on your investments for many years to come.