As someone who writes about personal finance for a living, I'm a big proponent of investing in stocks while you're young. In fact, I constantly find myself warning people about the dangers of investing too conservatively. So it might surprise you to learn that for the most part, I didn't dabble in stocks until I was nearly 30 years old. And while I did lose out on some potentially substantial gains by waiting that long to get into the game, I actually don't regret the decision one bit. Here's why.

The danger of short-term investing

The reason I stayed away from stocks for much of my 20s was simple: I was saving my money for short-term needs and goals. When I graduated college, my immediate goals were to build my emergency savings and pay off my student loans. For the former, I wanted close to a year's worth of living expenses in the bank, even though most people in my situation could've gotten away with half as much. But because I had lousy health insurance and had just experienced the shock of a random $1,500 medical bill, I wasn't willing to take chances.

Young businesswoman in meeting smiling

Image source: Getty Images.

I thought about buying stocks once my emergency savings were fully funded, but then I decided instead to save aggressively for another short-term goal: buying a house. It was around this time that my now husband and I had moved in together, and although he actually owned a home at the time we met, we knew we wanted to buy our own place together as soon as possible. Therefore it made sense to put our money into safe investments, like bonds, that would provide a little more income than a basic savings account, though not nearly as much as stocks. And it's a good thing we did, because we wound up buying our home in 2009, right on the heels of the worst recession we'd experienced in our adult lives.

In fact, had we invested our money in stocks a few years prior and pulled out of the market in early 2009, I can say with certainly that there's no way we would've managed our down payment. Between October 2007 and March 2009, the S&P 500 experienced a 57% decline. And while long-term investors may have since recovered (and then some), had I invested in 2006 or 2007 and pulled my money out in early 2009, that sort of loss would've been downright catastrophic.

And that's why I'm more than at peace with the fact that I spent the first six or seven years of my adult life avoiding the stock market (though I did invest my 401(k) in stocks, because that was money I knew I wouldn't be touching for decades). I knew that the money I was saving would need to be accessible in the near term, and I wasn't willing to risk losing a sizable portion of it. This, of course, was without knowing we'd be headed for a major recession come 2008.

And there lies the danger of short-term investing. You never know when the next downturn might hit, and if you put your money in stocks with the hope of cashing out quickly, there's a good chance you'll end up getting burned. Case in point: Between 1965 and 2015, the S&P 500 underwent 27 corrections of 10% or more, but it ultimately managed to recover from every single one. What this tells us is that the best approach to stock investing is to be in it for the long haul. If you put your money in stocks with the goal of cashing out your investments 20 or 40 years down the line, there's a good chance you'll come out ahead. But if your goal is to make a quick buck and get out, you may not be so lucky.

That's why when I write my articles, I generally tell people that they shouldn't put their money in stocks if they're planning to use that cash within seven years. That's just too narrow a window to ride out the market's inevitable ups and downs.

Meanwhile, the money I've invested in stocks since buying my home roughly eight years ago is money I haven't touched since. During that time, I've seen my balance go up and down, but I try not to fixate on it too much. At this point in my life, I know my money is where it should be, and while I may have missed out on a little growth opportunity during my 20s, I got the peace of mind of knowing that my money was available, in full, the second I needed it.