* Bernanke flexible on timeline for stimulus program * Bank of America rises after strong profit growth * Euro falls 0.5 percent vs dollar, gold declines NEW YORK, July 17 (Reuters) - Stock markets around the world rose on Wednesday and U.S. Treasuries yields slipped after Federal Reserve Chairman Ben Bernanke said the timeline for the U.S. central bank to end its stimulus program was not set in stone. The dollar rose against the euro and yen while gold tumbled below $1,300 an ounce Bernanke's flexible timing gave investors confidence and U.S. stocks closed near record highs. The Fed has said it would begin scaling back its quantitative-easing stimulus policies later this year if economic conditions meet its targets. While Bernanke reiterated the Fed's policy in testimony to a congressional committee on Wednesday, he noted that asset purchases "are by no means on a pre-set course." In answer to a question before the House Financial Services Committee, Bernanke said the Fed's intention "is to keep monetary policy highly accommodative for the foreseeable future" because of high unemployment and below-target inflation. "Nothing he said drastically changes the game, but markets have become more comfortable with Fed policy," said Andres Garcia-Amaya, global market strategist at J.P. Morgan Funds in New York, adding that the rise in interest rates could be enough to push the Fed to extend its stimulus. The Dow Jones industrial average finished 18.67 points, or 0.12 percent, higher at 15,470.52, the S&P 500 gained 4.65 points, or 0.28 percent, to 1,680.91 and the Nasdaq Composite added 11.5 points, or 0.32 percent, to 3,610. Bank of America Corp rose nearly 3 percent to $14.31 after it posted a bigger-than-expected 70 percent jump in quarterly profit. Bernanke's remarks also lifted European shares, which had been lower after minutes from a Bank of England meeting showed all policymakers voted against extending the bank's bond purchase program. Much like the Fed's, the program has been credited with boosting equity gains this year. In his first meeting in charge at the Bank of England, Mark Carney, joined by the bank's other eight policymakers, voted unanimously against more bond purchases, setting aside their differences ahead of a soon-to-be-released review on giving guidance about future interest rates. The FTSEurofirst 300 closed up 0.6 percent while an MSCI gauge of global stocks rose 0.2 percent. EURO WEAKENS, YIELDS FALL The U.S. dollar rose 0.2 percent against a basket of currencies, in a rebound from the three-week low the dollar index hit immediately after the release of Bernanke's prepared statement. Bernanke reiterated the U.S. central bank still expects to start scaling back its massive bond purchase program later this year, but he left open the option of altering that plan if the economic outlook changes. The euro fell 0.3 percent to close the U.S. session at $1.3124 and the greenback strengthened 0.5 percent against the Japanese currency at 99.57 yen. "I think the dollar had a mixed performance as the markets digest how to take this message on potential tapering of asset purchases but at the same time keeping policy accommodative for the foreseeable future via interest rate policy," said Brian Daingerfield, currency strategist at Royal Bank of Scotland in Stamford, Connecticut. U.S. Treasuries yields hit their lowest levels in two weeks following Bernanke's remarks. "I don't think there's any game-changing information. On the margin, it's a little more dovish, but the base case hasn't changed," said Gene Tannuzzo, portfolio manager at Columbia Management in Minneapolis. "Most likely, tapering will happen in September." Still, Bernanke led some to think that smaller bond purchases may instead begin next year and a Fed rate increase might be months, if not years, after QE3 ends, traders said. The benchmark 10-year U.S. Treasury note was up 11/32, its yield at 2.4907 percent. Yields on the 10-year have jumped since May, when Bernanke hinted the Fed would slow its bond purchase program this year. GOLD SLIPS In commodity markets, spot gold fell 1.3 percent to $1,274.89 hurt by expectations of a winding down of bond purchases by the Fed later this year. Copper fell 1.5 percent to below $6,890 a ton, giving up the previous session's 1.2 percent gain. Brent crude prices rose 47 cents to settle at $108.61 a barrel after the U.S. government reported declines in American crude inventories. U.S. crude traded up 48 cents to $106.48.