More than 90 percent of ordinary investors made money in stocks as the S&P 500 Index hit a record high in July, according to an analysis by investing social network Openfolio of more than 70,000 portfolios on its platform.
The average investor on Openfolio gained 3.49 percent in July, compared to a 3.69 percent total return for the S&P 500 last month.
Returns from technology stocks helped ordinary investors come close to matching the S&P 500.
Direct ownership of the 25 most popular tech stocks on Openfolio — including Amazon, Apple, Facebook, Tesla and Google's parent company Alphabet — accounted for more than 35 percent of the July gains. And that figure doesn't include exposure ordinary investors have to tech stocks in the mutual funds and exchange-traded funds they own.
For the first seven months of 2016, average investor returns on Openfolio have lagged the S&P 500 by more than 3 percentage points. That's not uncommon in bull markets, because these investors typically have a mix of stocks, bonds and cash.
Despite the decent returns from stocks, ordinary investors are building up their cash positions. Average cash holdings of Openfolio users has grown by 25 percent since May.
"Three months ago, the average portfolio had 8.1 percent in cash, the lowest level we had seen on the platform, and now average cash holdings are 10.3 percent," said Hart Lambur, founder and CEO of Openfolio, which lets users anonymously compare their portfolios to other investors.
Ordinary investors are moving to cash, where the average one-year certificate of deposit yields 0.29 percent, as many market analysts are warning about stocks.
A 10 percent drop in stocks was "quite possible" in the coming months, Peter Oppenheimer, chief global equities strategist at Goldman Sachs, told CNBC Tuesday.
Bond guru Jeffrey Gundlach, the chief executive of DoubleLine Capital, said Friday that investors should "sell everything."