The S&P 500 flashed a rare buy signal on Monday. Historically, this means stocks are primed for strong gains in the next six to 12 months.