Nasdaq heads for 20% quarterly gain, S&P 500 best since 2020