The S&P 500 rose about 2% in December as the Trump rally rolled on, but that didn't stop a large number of individual investors from locking in gains.

"We've been seeing profit-taking in some sectors after the election, even when the S&P 500 was hitting new highs," says Steve Quirk, executive vice president of the trader group at TD Ameritrade (AMTD) - Get Report .

The behavior-based TD Ameritrade Investor Movement Index, or IMX, which aggregates Main Street investor positions, fell 1% to 5.48 in December as retail investors slightly decreased their exposure to the U.S. equity markets for the second month in a row. The VIX, or so-called fear index, started and finished the month at 14.

Each month, TD Ameritrade pulls a sample from its client base of 6 million funded accounts that includes all accounts that completed a trade in the past month. The holdings and positions of this statistically significant sample are evaluated to calculate individual scores, and the median of those scores represents the monthly IMX.

As the holiday shopping season reached its peak in December, Amazon (AMZN) - Get Report was a net buy. This is the third month in a row TD Ameritrade clients were buyers of Amazon as well as of Facebook (FB) - Get Report .

Bank of America (BAC) - Get Report , which appeared to stabilize following a dramatic increase after the presidential election in November, was also a net buy. Chipmaker Nvidia (NVDA) - Get Report , one of the best performing stocks in the S&P 500, was also a popular buy.

On the flip side, Apple (AAPL) - Get Report was net sold during the December IMX period as it traded up toward its year-to-date high. Energy sector issuers ConocoPhillips (COP) - Get Report and Chevron (CVX) - Get Report were net sold as their share prices appeared to match gains in crude oil prices, which rose above $50 for the first time since October.

Looking back at 2016, Quirk said TD Ameritrade clients were net buyers overall in 2016, increasing their equity positions heading into 2017. The most popular buys of these investors over the past year were Amazon, followed by Facebook. Valeant Pharmaceuticals (VRX) , Gilead Sciences (GILD) - Get Report and Alphabet (GOOG) - Get Report rounded out the ranks of the top five stocks bought.

The five most popular stocks sold in 2016 by TD Ameritrade clients were Apple, Netflix (NFLX) - Get Report , Alibaba (BABA) - Get Report , Bank of America and Chevron.

Apple and Facebook are holdings in Jim Cramer'sAction Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells these stocks?Learn more now.