gold firms after three days of losses as stocks drop