Open this photo in gallery:

Traders work on the floor at the New York Stock Exchange Sept. 4.Jeenah Moon/Reuters

The U.S. stock market is roaring higher. That is to be expected. It does this every 25 years or so.

Unfortunately, the aftermaths of these euphoric periods aren’t usually pretty. Investors who don’t want to be blindsided may want to ponder a few unfortunate moments in Wall Street history.

Start with the last bubble: Just over 25 years ago, in the mid-to-late 1990s, euphoria over the potential of the brand-new internet drove tech stocks such as Intel Corp., Cisco Systems Inc. and Nortel Networks Corp. to absurd peaks. That was followed by a painful multiyear crash. The tech-heavy Nasdaq Composite Index lost three-quarters of its value from 2000 to 2002. It didn’t claw its way back to its dot-com high until 2015.

A similar story played out 25 years earlier, when investors went wild for the Nifty Fifty stocks – a tech-heavy group that included such hot young things as Polaroid Corp., Xerox Corp. and International Business Machines Corp. Enthusiasm for those supposedly invulnerable businesses propelled Wall Street to giddy heights in the early 1970s.

The euphoria vanished when an oil crisis, rising inflation and the Watergate scandal yanked the market back to reality in 1973 and 1974. The benchmark S&P 500 Index lost nearly half its peak value. It did not regain its previous peak until 1980 in nominal terms and not until 1993 when adjusted for inflation.

Is today’s AI boom bigger than the dotcom bubble?

To be sure, this neat 25-year-or-so cycle between the U.S. market frenzies of 1973, 1999 and 2025 breaks down if you look at the market’s relative calm in the late 1940s and early 1950s. Perhaps the Second World War disrupted the normal sequence of events.

Peer back just a bit further, though, and you can see the best-known bubble of them all. That was the Jazz Age madness of the late 1920s, when excitement over breakthrough innovations such as radios, airplanes and cars drove share prices to record levels and prompted even shoeshine boys to play the market. Radio Corp. of America (RCA) and Columbia Phonograph Co. were just two of the hot stocks that seemed to have endless room to grow.

When Wall Street crashed in October, 1929, it devastated a generation. The Great Depression followed. The Dow Jones Industrial Average didn’t recover its 1929 peak until 25 years later.

You can debate the precise mechanics of these various bubbles, but it’s hard to miss the similarities among them. In each case, the starting point was the appearance of legitimately exciting new products. These innovations prompted enthusiasts to declare that a new era was at hand. Their excitement set off a stampede of speculation. The stampede drove stock prices forward, drawing in crowds of eager new investors until prices hit levels that assumed perfection and beyond.

All of which sounds rather like today, doesn’t it? Sure, artificial intelligence is an exciting breakthrough. So were radio, mainframe computers and the internet back in their days. The question is whether investors are once again expecting too much from a fascinating new technology.

Most of the standard ways to value stocks scream that expectations are now way too high. When you compare stock prices to their underlying revenues or earnings, the current U.S. stock market is just as expensive as it was at its previous bubble peaks.

David Kelly, chief global strategist at J.P. Morgan Asset Management, warns that Wall Street’s “serious valuation issues” may be even more serious than most investors realize. People are not just paying a lot for each dollar of a stock’s earnings, he points out. They are also paying those share prices based upon levels of corporate profitability that seem inflated in comparison with historical norms.

Nvidia CEO says AI boom far from over after chip maker releases tepid sales forecast

At the height of the dot-com bubble, in early 2000, adjusted after-tax profits for the S&P 500 accounted for 6.4 per cent of U.S. gross domestic product. Today, those adjusted after-tax profits account for 10.8 per cent of GDP.

This is worrisome because profits can’t expand forever as a share of the U.S. economy. By historical standards, they are already lavish. It’s hard to see how they can grow rapidly from an already elevated share of the economy. If anything, profits seem more likely to stagnate, or even decrease, as a piece of the overall economic pie.

Yet investors aren’t playing it safe. They seem confident that profits can grow and keep on growing at historically unusual levels for as far as the eye can see.

Their confidence may reflect excitement about the potential of AI, but even cheerleaders such as Sam Altman, chief executive of ChatGPT-creator OpenAI, warn that expectations are running ahead of reason. “Are we in a phase where investors as a whole are overexcited about AI? My opinion is yes. Is AI the most important thing to happen in a very long time? My opinion is also yes,” he was quoted as saying last month.

At such giddy times, it pays to ponder history. I remember a white-haired stockbroker telling me during the dot-com insanity that markets go crazy once a generation, because a new bubble can’t really get going until all the investment pros who remember the last one retire. This may explain the regular occurrence of market frenzies once every 25 years or so.

Personally, I’m prepared to edge back from the current Wall Street silliness, focus on non-U.S. investments and start getting ready for the great bull market of 2050.