Almost exactly a year ago, Donald Trump dismissed the stock market's rise under President Barack Obama as a "big bubble." Now President Trump is cheering as the Dow reaches 22,000 for the first time.

A surge in Apple stock carried the Dow past the milestone Wednesday right after the opening bell. The average is up more than 3,600 points since Trump's victory last November.

Wall Street's record-shattering performance is a bright spot for an administration mired in legislative failure and internal turmoil. Instead of warning about a market bubble, as Trump did repeatedly as a candidate, the White House now cites the stock records as affirmation of his policies.

Trump has broken with precedent by frequently bragging about the market, often on Twitter, and cheering for it to go much higher.

He did it again on Tuesday before trading even began.

"Stock Market could hit all-time high (again) 22,000 today," Trump tweeted 41 minutes before the opening bell on Wall Street -- and, it turned out, a day early.

The prediction was far from what Trump said during the first presidential debate last September -- that the market was a "big, fat, ugly bubble." And the market is much higher today than it was then.

By closing above 22,000 on Wednesday, the Dow has notched its sixth straight record and 49th since Trump was elected. CNNMoney's Fear & Greed index of market sentiment is firmly in "greed" mode, suggesting the gains could continue.

Apple, one of the 30 stocks that make up the Dow, lifted it over 22,000. Apple stock climbed 6% to an all-time high of its own because of optimism about the next version of the iPhone.

Related: Is this a sign that stocks are too hot?

Investor euphoria after the election seemed fueled by enthusiasm for the Trump agenda of tax cuts, deregulation and infrastructure spending. The stock surge became known as the "Trump rally."

But Wall Street is focused less on Washington now. Investors have dialed back their bets on the "massive" tax cuts Trump promised. The U.S. dollar soared after the election because of expectations that tax cuts and public works spending would accelerate the economy. Now the dollar has lost ground against other currencies five months in a row.

The market has shattered records despite Trump's political troubles, suggesting they are no longer intertwined. The Dow has hit 22,000 as deals with the sudden exits of White House Chief of Staff Reince Priebus and communications director Anthony Scaramucci.

Instead of living and dying on politics, the market has been carried higher by big corporate profits. Apple, Boeing (BA), McDonald's (MCD) and Facebook (FB) have all reported healthy earnings in recent days.

"Investors realize the real question is not whether there's turmoil in Washington, but what will it do to earnings from American companies? The answer is usually very little," David Kelly, chief global strategist at JPMorgan Funds, told CNNMoney before the market opened.

Related: Trump is playing with fire by obsessing over stocks

Wall Street is also thriving because of a Goldilocks effect: Economic growth is steady, but not in danger of overheating. That has allowed the Federal Reserve to gradually remove the easy-money policies that have supported stocks.

How long can stocks keep rising without taking a breather? It's been nearly 400 trading days since the S&P 500 suffered a 5% decline, the longest streak since 1996, according to Bespoke Investment Group.

And August has a history of market scares. On August 24, 2015, the Dow spiraled 1,000 points before it rebounded. The S&P 500 nearly plunged into a bear market in August 2011 after the U.S. credit rating was downgraded.

"Let's not forget that crazy stuff happens in August," Michael Block, chief market strategist at Rhino Trading, wrote in a report.

JPMorgan's Kelly urged investors not to "get lulled into complacency" by the new highs in the U.S. stock market. He said there are better opportunities in overseas markets, especially in Europe.

"People shouldn't get mesmerized by Dow 22,000," he said.