If there is a bright side to this bear market, some good stocks have come way down in value and make for good buys when the market inevitably heads north. As a long-term investor, you should measure performance by years, not quarters, so a not-so-pretty year-to-date return right now could become a great investment when you look back in 20 years.  

While there is still a lot of uncertainty in the markets, there are two stocks in particular that have dropped in price that look like strong candidates to thrive over the long run: Amazon (AMZN -1.54%) and Bank of America (BAC -1.54%). A $5,000 investment now in these two giants would probably look pretty good when you retire. 

1. Amazon: Its stock split makes it more accessible

Amazon, the world's largest online retailer, made some news in June when it did a 20-for-1 stock split. That means that one share of Amazon, which was $2,447 at the time of the split, would be split into 20 shares. So, if you owned shares of Amazon, you now had a lot more, as you owned 19 more for each share you had. If you don't own Amazon, it gives you an opportunity to buy this mega-cap stock at a much more reasonable entry price -- about $122 per share at the time of the event. Among other reasons for the stock split, the move made Amazon more accessible to more investors. 

But while its price changed, all of its fundamentals stayed the same. And since the split, the stock price has bounced around, but remains around $122 per share. That's still down 27% year to date as of Oct. 4, but given the state of the economy, it has performed fairly well. Through the first half of the year, revenue was up 3.2% year over year, which is slower growth than usual, but this is not your typical economic environment.

But over the second half of the year, revenue should perk up. In the third quarter, the company expects a 13% to 17% year-over-year revenue boost, and the fourth quarter should be its strongest of the year, with the holidays coming. In addition, Amazon has rolled out some new products to spur sales, like a new smart TV, the Scribe, which is an update to the Kindle, as well as new Echo and Ring products. 

The stock price should start to increase, as analysts' consensus estimate sets a $170 price target over the next 12 months -- a gain of about 39% from current levels. Of course, the economy is still a wild card in the short term, but when you look 20 or 30 years down the road, Amazon, as the dominant force in e-commerce and the market leader in cloud computing, is only going to keep growing.

2. Bank of America: One of Warren Buffett's favorites

There is a reason that Bank of America is the second-largest holding in Warren Buffett's Berkshire Hathaway portfolio, occupying about 10% of it. It is the second-largest bank in the country and, as one of four national megabanks, it has few real competitors. And among the four megabanks, it has been one of the most consistent performers. Over the past 10 years, Bank of America has posted an average annual return of 13.5% as of Oct. 3, which is the best among the big four banks.

JPM Chart

JPM data by YCharts

Banks are cyclical and tend to perform well in strong, growing economies. But while the economy has contracted the last two quarters, Bank of America has been able to boost revenue and increase loans. Higher interest rates have benefited Bank of America, offsetting a year-over-year revenue drop in the investment banking business.

The environment could be more challenging over the next few quarters if we go into recession, but over the long term, large, well-run banks like Bank of America are going to do well when the economy is growing. And periods of economic growth are historically much longer than periods of recession.

Also, Bank of America is really cheap right now with a forward price-to-earnings ratio of around eight and a price-to-book ratio of one -- which means it is trading at its book value.

Like Amazon, Bank of America is a market leader and the type of great business that you can count on over the long term, through the market's ups and downs. And at $32 per share, you could buy about 75 shares of Bank of America, to go along with roughly 20 shares of Amazon at $122 per share.

Combined, that would give you a nice chunk of these two stalwart stocks for about $5,000, which should grow steadily until retirement.