Stocks closed up today:

▲ Dow: +0.83 percent
▲ Nasdaq: +0.81 percent
▲ S&P: +0.79 percent

Precious metals:

▼ Gold: -1.28 percent to $1,751.83 an ounce
▼ Silver: -0.94 percent to settle at $34.11

Commodities:

▼ Oil: -0.59 percent

Markets were up because:

Stocks gained on signs that lawmakers are edging toward a deal that would help the U.S. avoid the “fiscal cliff.”

Indexes shrugged off an early loss and rose in afternoon trading Wednesday. The Dow Jones industrial average closed up 106.98 points at 12,985.11. It had been down as much as 112 points in early trading.

The Standard and Poor’s 500 was up 10.99 points at 1,409.93. The Nasdaq composite rose 23.99 points to at 2,991.78.

Huge tax increases and spending cuts will come into effect Jan. 1 if no deal on the U.S. budget is reached. Economists say the measures could push the country back into recession. President Barack Obama said he believed both parties can reach a “framework” on a debt-cutting deal before Christmas, while House Speaker John Boehner told reporters that he was optimistic a deal could be reached, according news outlets including CNBC.

Concern that the U.S. will go over the fiscal “cliff” has weighed on stocks since the Nov. 6 elections returned a divided government to power, with President Barack Obama staying in the White House and Republicans retaining control of the House.

As the third-quarter corporate earnings period draws to a close, investors and traders have become increasingly fixated on the negotiations to cut the budget deficit. Before Wednesday’s gain, the market slumped Tuesday after Senate Majority Leader Harry Reid said he was frustrated by the lack of progress in talks. The two moves canceled each other out, leaving both the Dow and the S&P 500 little changed for the week.

Many companies are making special end-of-year dividend payments or moving up their quarterly payouts because investors will have to pay higher taxes on dividend income starting in 2013, unless lawmakers reach a compromise on taxes and government spending.

Costco, the wholesale club operator, surged $6.07 to $102.58 after the company said it would pay a special dividend of $7 a share next month, in addition to its regular quarterly dividend. Las Vegas Sands Corp. rose 5.3 percent Tuesday after the casino operator said it would distribute about $2.26 billion to shareholders before the end of the year. It rose another 1.3 percent Wednesday, gaining 60 cents to $49.96.

With the market’s attention focused on the outcome of the “cliff” negotiations, some investors caution that the weakness in third-quarter corporate earnings bode poorly for the stock market.

Company earnings fell 0.9 percent in the third quarter, data provider FactSet said in a report Nov. 23. If they earning finish the period lower, it would mark the first decline in three years.

In economic news, U.S. sales of new homes dipped 0.3 percent in October, though they’re up 20.4 percent for the year, according to a government report. Stable home prices suggest the housing market is steadily recovering.

The yield on the 10-year Treasury note fell to 1.63 percent from 1.64 percent.

The Associated Press contributed to this story.