Stocks notch seven straight months of gains, dollar flat