Here’s the secret reason stocks have been rising: Technician

What massive M&A means for stocks

Notwithstanding Tuesday's decline, a hidden dynamic is behind the persistent gains for stocks over the past three years, noted market technician Craig Johnson argues. To wit, even as demand for equities remains strong, the supply of shares is falling due to mergers and acquisitions, buybacks and a general decline in the number of publicly traded companies.

Johnson, senior technical research analyst at Piper Jaffray and president of the Market Technicians Association, finds that the number of "investible" publicly traded companies (defined as those with a price above $5 and a market capitalization greater than $25 million) has fallen by 25 percent over the past 13 years, thanks largely to heavy acquisitions and a decline in the number of initial public offerings.

At the same time, the average share price of the 500 largest U.S. stocks has doubled from $40 to $80, Johnson reports. In addition to mergers and acquisitions, corporate buybacks are also a likely driver behind this trend, as repurchases reduce the number of a company's shares.

"All of these pieces together ... is underpinning the kind of structural advance we've seen in the market," Johnson said Friday in an interview with CNBC's "Trading Nation."

"There's less product out there, more money's coming into equities and there are just fewer homes for that money to go to work," he explained. "So there is a strong underpinning, we think, to the market."

The general dealmaking trend shows no signs of easing up, either. According to Thomson Reuters, global M&A for 2015 has totaled $1.5 trillion, which is 23 percent higher than the same time period in 2014.

Want to be part of the Trading Nation? If you'd like to call into our live Monday show, email your name, number and question to TradingNation@cnbc.com.