Stocks poised for near-term rally after S&P 500 flirts with bear market, but selling is not over