US stocks set to end bad quarter on strong note