(Bloomberg) — Gold was headed for a third weekly gain, as hopes for a diplomatic resolution to the war in Iran and sustained buying by central banks outweighed persistent risks around inflation.

Bullion steadied near $4,760 an ounce on Friday, on track for a weekly gain of almost 2%. With key issues around the Middle East conflict unresolved, attention is turning to weekend negotiations in Islamabad, where a US delegation led by Vice President JD Vance is scheduled to meet Iranian officials. Traders will also be watching the US inflation report later on Friday.

President Donald Trump said he is “optimistic” about a deal to end the six-week conflict but later threatened Tehran over charging fees to let ships pass through the Strait of Hormuz. Israeli strikes in Lebanon have also jeopardized a fragile ceasefire agreed earlier this week.

Oil was on track for a weekly loss, while stocks have recovered and a gauge of the dollar has fallen 1.3% this week, supporting gold that’s priced in the US currency. Since the war began at the end of February, however, bullion has still lost nearly 10%, with its haven appeal dulled by investors’ need to cover losses elsewhere.

The energy supply shock from the conflict has also raised inflationary risks, leading traders to place bets that central banks will delay interest-rate cuts or even raise them. This is a headwind for non-yielding gold, which benefits when borrowing costs are lower.

“Any prediction starts with a call on the war,” said Kyle Rodda, an analyst from Capital.com based in Melbourne. “If the ceasefire holds and a peace deal gets done, and future inflation is contained, gold recovers,” he said. “If things fall apart — which they could — then there’s still significant downside risk.”

US consumer spending barely rose in February against a backdrop of persistent inflation even before the war began, a report from the Bureau of Economic Analysis showed on Thursday. A more updated picture will emerge later Friday with the March consumer price index report. Economists surveyed by Bloomberg expect the data to show the biggest monthly increase since June 2022.

Countering bets on higher borrowing costs, however, a protracted war could also lead to a slowdown in growth that would hurt the labor market and warrant lower rates. Minutes of the Federal Open Market Committee’s March 17-18 meeting released this week showed officials wrestling with two-sided risks from the conflict.

Gold has also been supported by signs that some of the world’s biggest bullion buyers are continuing to build their stockpiles. Poland’s central bank is maintaining a goal to lift reserves to 700 tons, its governor said, while China took advantage of lower prices to add about 5 tons in March – its biggest monthly purchase in more than a year.