Bank of America says it might be time for a new way of thinking about a longstanding bit of investment advice.

In a recent note to clients, the bank said it was brushing aside the adage to "Sell in May and go away" — at least for this year.

The idea behind the saying is that investors should get out of the market from May to October, a period known for being the S&P 500's weakest six-month stretch of the year. But that wisdom doesn't hold up when looking at the data, and investors may want to hold on to see stronger gains through the summer, analysts at the bank wrote, citing their analysis of stock prices stretching back over the past 98 years.

The May through October period has historically been the most challenging for the S&P 500. Over the last century, the benchmark index gained an average 2.4% during those six months, the lowest return compared to any other six-month period of the year.

But weakness in the May-October period is often "back-end loaded," the BofA analysts said. On average, the S&P 500 shed 0.2% during the August to October period, the worst return of any three-month period.