Stocks just closed out a big quarter. History shows this is what usually happens next

The Wall Street Bull, located in the financial district of New York City.
Mike Roy | MCT | Tribune News Service | Getty Images

Wall Street just wrapped up its best quarter in decades and gains of that magnitude usually signal momentum into the next quarter, if history is any indication.

The S&P 500 rallied nearly 20% in the second quarter, notching its biggest quarterly gain since the fourth quarter of 1998, when it surged 20.9%. It was also the S&P 500's fourth-biggest quarterly gain since 1950.