A year that had been looking pretty bleak for the stock market suddenly appears to be turning a corner.