Gold edged higher on Tuesday as the dollar weakened, though gains were capped by improved appetite for riskier assets after U.S. President Donald Trump left the hospital where he was treated for COVID-19.

Spot gold  rose 0.3% to $1,917.86 an ounce by 1205 GMT, having hit its highest in almost two weeks on Monday at $1,918.36. U.S. gold futures gained 0.2% to $1,923.90.

"The moderating dollar is eroding some of the downward pressure on spot gold," said FXTM market analyst Han Tan.

He added that while news of Trump's improving condition had initially encouraged risk-on sentiment, it could be short-lived, with questions continuing to swirl about the true state of the president's health.

The dollar fell 0.1% against a basket of major currencies, making gold cheaper for holders of other currencies.

Global stock markets neared a more than two-week high after Trump returned to the White House, and on expectations of new coronavirus economic relief measures in the United States. 

"Should the next round of U.S. fiscal stimulus be approved, that may lend upward pressure to the U.S. inflation outlook while encouraging gold bulls to return to the fore," FXTM's Tan said.

Gold, seen as a hedge against inflation and currency debasement, has risen 26% this year, supported by massive government and central bank stimulus worldwide.

"The main risk is the upcoming U.S. elections. If the election is close and Joe Biden has the lead and Trump does not concede, then we will enter a prolonged period of uncertainty," said Commerzbank analyst Carsten Fritsch.

"And that will be dovish news for the dollar and bullish news for gold."

Elsewhere, silver rose 0.3% to $24.42 an ounce, palladium fell 0.3% to $2,355.55 and platinum shed 1.1% to $886.76.

(Reporting by Sumita Layek in Bengaluru Editing by Kirsten Donovan and David Goodman) ((Sumita.Layek@thomsonreuters.com; Within U.S. +1 646 223 8780, Outside U.S. +91 8061822693; Reuters Messaging: Sumita.Layek.thomsonreuters.com@reuters.net))