Gold holds on to overnight gains as stocks, dollar retreat