Q: I have about $5,000 to invest in a specific stock. I want to put all $5,000 into it, but someone told me I should buy a little at a time instead. Which is the best way to go?

Many investors buy shares via dollar-cost averaging, which means investing an equal amount of money into a stock at predetermined time intervals. For example, instead of investing your $5,000 all at once, you might choose to invest $1,000 every month for the next five months.

To be sure, dollar-cost averaging has some major advantages. It helps take emotion out of your investment strategy and lowers the risk of buying while a stock is too expensive. By investing equal dollar amounts, you'll buy fewer shares when the stock is expensive and more when it's cheaper. Over time, the mathematics work out in your favor.

On the other hand, the downside is that dollar-cost averaging prevents you from being opportunistic.

My general thought is that if you're buying a stock because you think it's an exceptionally good value that won't last, there's nothing wrong with buying all at once. On the other hand, if you're buying because you want to own the stock, but there's nothing extremely compelling about its value right now, dollar-cost averaging is probably the better way to go.

I'll give you a real-world example from my own portfolio. In early 2018, the stock of one of my favorite companies, Realty Income, was trading for a price that hadn't been seen in several years and the valuation just seemed too good to be true, so I went ahead and bought a large chunk of shares in a single transaction.

On the other hand, when General Electric slashed its dividend last year and shares plummeted to about $10, I liked the stock from a long-term perspective, but there was nothing that was screaming "buy right now" about the $10 share price. So, I decided to average into a position over a three-month period.

In short, ask yourself why you're buying the stock now, and decide accordingly.