US stocks are back at all-time highs as the longest bull market in American history continues its record-setting run, driven in part by continued growth in high-tech stocks.

How much longer can the good times roll?

It’s anyone’s guess, but bull markets and economic expansions don’t die of old age. Credit crunches, political uncertainty, wars and rampant speculation have ended previous bull markets.

Overall, the S&P 500 has gained 334% in the 121 months since its Great-Recession low in March 2009. Bull markets occur when stocks gain at least 20% from their most recent low. Since the Great Depression, that’s happened 12 other times to the S&P 500, according to Howard Silverblatt, senior index analyst for S&P Dow Jones Indices.

Here’s how they each came to an end.

1932 to 1937: Recovery from the Great Depression

It took several years for financial markets to start recovering from the Great Depression, the deepest recession in modern American history. The Composite Price Index, a predecessor to the S&P 500, fell 86% between September 1929 and June 1932, but then followed that slump with 325% gains over the next five years.

The bull market was supported in part by President Franklin Roosevelt’s New Deal, which unleashed massive government spending programs to stabilize the economy. But four years later, Roosevelt pulled back on those programs. He slashed spending to balance the budget. Around the same time, the Federal Reserve tightened its reserve ratios for banks. Its timing was off. The economy hadn’t fully recovered from the Great Depression yet, and tighter monetary and fiscal policy led to a double-dip recession, often called Roosevelt’s recession.

From March 1937 to April 1942, stocks declined 60%.

1942 to 1946: World War II drives economic activity

The United States entered World War II in December 1941 after Japanese bombers attacked Pearl Harbor. American factories ramped up production of tanks, machine guns and fighter planes. Women, who previously had been discouraged from working outside their homes, took over manufacturing jobs as men went abroad to fight. Fueled by the war effort, the S&P 500 gained 158% from April 1942 to May 1946.

The sudden jolt to the economy wasn’t sustainable. Americans eventually cut back on spending and ramped up their savings, which led to a minor economic slowdown known as an inventory recession. From May 1946 to June 1949, the S&P 500 fell 30%.

1949 to 1956: The post-war economy booms

After the war ended, the United States enjoyed an era of prosperity. President Dwight Eisenhower focused on balancing the federal budget. Consumerism flourished, propelled by the idea of the American Dream and a suburban utopia, complete with automobiles and television sets for every family. Americans had more children, fueling what would later become known as the Baby Boom. The S&P 500 gained 266% between June 1949 and August 1956.

The stock market boomed so much that by 1955, lawmakers feared it could end in a 1929-like bust. The Senate Banking Committee launched a “friendly” inquiry into the stock market, to consider whether new regulations were needed. That same year, Federal Reserve Chairman William McChesney Martin, Jr., delivered a famous speech likening the central bank to a chaperone that needs to take away the “punch bowl” just as a party is warming up.

The central bank raised interest rates and economic growth slowed. The Suez Canal crisis and the Soviet Union’s invasion of Hungary added to uncertainty fueling the minor bear market. From August 1956 to October 1957, the S&P 500 fell 22%.

1957 to 1961: The Cold War ramps up

In 1957, the Soviet Union launched Sputnik, the first man-made satellite to orbit Earth. US stocks declined as American leaders worried that their country was losing the Cold War. But after a short-lived bear market, the S&P 500 enjoyed nearly four years of growth, gaining 86% between October 1957 and December 1961.

When the bull market eventually fizzled out, it wasn’t entirely unexpected. As a young Warren Buffett noted at the time, “stocks have been rising at rather rapid rates. Corporate earnings have not been rising. Dividends have not been increasing.”

In other words, stocks were overvalued and a decline was warranted. Stocks declined 28% between December 1961 and June 1962.

1962 to 1966: JFK aims to ‘get America moving again’

On the campaign trail, President John Kennedy had promised to “get America moving again,” but after he took office in 1961, tensions flared between the president and the steel industry, leading to a brief bear market known as the Kennedy Slide. Stocks eventually started picking up again in 1962.

Later, in 1963, the bull market was dealt a scare when Kennedy was assassinated. The S&P 500 plummeted nearly 3% that day and trading was shut down two hours early to honor JFK’s memory.

But Wall Street rebounded swiftly, with the market recovering all its losses just days later. The market expansion endured for nearly three more years.

Heading into 1966, the economy was strong. Unemployment was just 4% and companies were rushing to fill large back-orders for goods. But when inflation started picking up, the Federal Reserve responded by tightening credit conditions. The move proved too restrictive and triggered a credit crunch. The S&P 500 fell 22% from February to October 1966.

1966 to 1968: The go-go years

Spanning barely two years, the mid-1960s bull market was the shortest in modern American history. But the S&P 500 still managed to soar nearly 50% during the run. nThe stock market was boosted in part by a robust job market. By late 1968, the unemployment rate was just 3.4%. But the period was also marked by social and political earthquakes.

1968 marked a turning point for the Vietnam War, when the North Vietnamese launched a surprise attack known as the Tet Offensive. Martin Luther King, Jr., and Robert Kennedy were assassinated, and in November, Richard Nixon won the presidential election. Instability, coupled with a weakening economy and high inflation, led to a bear market and a minor recession. The S&P 500 fell 36% from November 1968 to May 1970.

1970 to 1973: Investors buy the Nifty Fifty

McDonald’s, IBM and Disney helped carry the American stock market to new heights in the early 1970s. Investors piled into the Nifty Fifty, a group of the country’s largest and fastest-growing companies. The S&P 500 generated strong annual gains north of 23% on average during the bull market. But the mania eventually went too far. Valuations on Nifty Fifty stocks such as Polaroid and McDonald’s were inflated to unsustainable levels.

Then, in January 1973, President Nixon announced phase three of his economic plan, relaxing wage, price and rent controls he had enacted in earlier years. Although he asked businesses and workers to continue to follow the guidelines voluntarily, they seized upon the opportunity to raise prices and make wage demands. Runaway inflation followed. The S&P 500 declined 48% between January 1973 and October 1974.

1974 to 1980: A modest bull

The stock market didn’t exactly go gangbusters during this bull market between 1974 and 1980. The S&P 500 generated annual returns of just 14% on average, the weakest of the modern era, as investors grappled with the 1970s oil crisis.

Amid double-digit inflation, Federal Reserve Chairman Paul Volcker quickly ratcheted up interest rates to as high as 20% in the early 1980s. While that strategy, known as the Volcker Shock, succeeded in taming price increases, it also made it more expensive to borrow money and ushered in a recession. The S&P 500 fell 27% between November 1980 and August 1982.

1982 to 1987: Reaganomics

After Volcker tamed inflation, President Ronald Reagan cut taxes, sending the stock market soaring. The S&P 500 boomed, generating average annual returns of nearly 27% — the best since during the Great Depression. And the unemployment rate broke below 6%, down from a peak of nearly 11%. But the bull market would end in an instant as the Dow crashed an astonishing 22.6% on October 19, 1987, a day now known as Black Monday.

Computerized trading, which was still relatively new, was partly to blame. The bear market was super short, lasting only three months. While the S&P 500 fell nearly 34% between late August and early December, it still finished the year in positive territory.

1987 to 1990: The Black Monday comeback

After Wall Street’s darkest day proved to be just a blip for stocks, the S&P 500 advanced 65% from December 1987 to July 1990, marking the second shortest bull market in the modern era before another downturn struck. The United States entered a mild recession in July 1990 as oil prices more than doubled after Iraq invaded Kuwait.

Between July and October 1990, the S&P 500 fell 19.9%, making it a borderline bear market because it fell just shy of a 20% drop.

1990 to 2000: Roaring 90s

The end of the Cold War and the dawn of the Internet Age ushered in an era of enormous prosperity. The S&P 500 surged more than 400% over the decade, driven higher by robust economic growth and stable inflation. It remains the strongest bull market ever. The United States experienced the longest period of uninterrupted economic growth in modern history. Investors, sensing the enormous potential of the internet, recklessly piled into dot-com stocks in what Federal Reserve Chairman Alan Greenspan dubbed “irrational exuberance.”

Eventually, frothy share prices were no longer justified by underlying business fundamentals. Many of these companies, like, went belly-up. The S&P 500 fell 49% between March 2000 and October 2002.

2002 to 2007: Housing boom

The mid-2000s bull market planted the seeds for the meltdown that would arrive later in the decade. Aided by low interest rates from the Greenspan-led Federal Reserve, the period was marked by excessive leverage. Subprime mortgages enabled more Americans to purchase homes often with no down payment and at short-term “teaser” rates. The real estate market surged and rising home values led Americans to spend aggressively. Stocks rose 102% between October 2002 and 2007. But Wall Street made risky bets that eventually backfired.

When home prices starting falling, borrowers began defaulting en masse. Investment banks like Bear Stearns and Lehman Brothers, which held some of the risky subprime debt, suffered huge losses and collapsed.

The deepest financial crisis and recession since the Great Depression followed, with the S&P 500 falling nearly 57% between October 2007 and March 2009.

2009 to now: Long, slow recovery

No matter when it ends, the recovery from the Great Recession is already the longest bull market in American history. Spanning more than a decade, the market boom has been driven by a combination of slow-but-steady economic growth, record corporate profits and record low interest rates.

The bull market, after surviving several near-death experiences, has catapulted to quadruple its crisis low. The record-setting rally has been punctuated by the rise of the tech industry, with Apple, Amazon and Google joining Microsoft as America’s most valuable companies.