Just about four out of 10 investors age 21 to 50 are confident they will have enough money to retire, according to a recent online study by Baltimore-based T. Rowe Price.

Of course, the biggest advantage that young investors have is their youth. They have more years to salt away money so they don't need to save as much. And the magic of compounding does the rest.

While it sounds that these younger investors are a bit dour, two-thirds expect to receive Social Security benefits.

“Younger investors’ confidence in the Social Security system was surprisingly positive,” says Christine Fahlund, Price’s senior financial planner in a statement. “Still, it shouldn’t be relied upon too heavily.”

Two-thirds of the 860 adults polled also don't have a detailed plan for their finances in retirement. According to Price, a detailed plan would include a “monthly withdrawal strategy” or takes into account life expectancy and how long a nest egg need to last.

I’m not surprised by that statistic. It doesn't seem realistic to expect workers in their 20s or 30s to have a serious plan about monthly withdrawal strategies for three or four decades down the road.

One area that younger investors appeared to be too optimistic is when they expect to retire. 

The average age these investors anticipate retiring is 62. Waaaay too early. And how long do they expect to live in retirement? Twenty-two years. That would mean they expect to die on average at 84.

To avoid coming up short, Price suggests they save at least 15 percent of their salary each year and expect to live to 95.