Here's the problem with index ETFs

Index ETFs have grown in popularity as a play for diversification and dollar-cost averaging. But are they really a safe and smart way to invest? I looked back over the last 23 years and found out it can vary — and it's important to know why.

Dollar-cost averaging is where you buy a fixed-dollar amount of shares regularly (So, you buy more shares when the stock price is lower and less when it's higher). Warren Buffett is a fan.

During market swoons, Buffet always reminds us that he is adding to his high-conviction positions. "Be greedy when others are fearful," he says.

But dollar-cost averaging isn't always a wise strategy.

Index ETFs, which track stock-market indexes, have gained in popularity because of their low fees and the perception that many active managers are unable to keep up with their benchmarks. Also, many ETFs have built-in diversification, which is another one of the tenets of successful long-term investing. But when it comes to getting the full benefits of dollar-cost averaging, index ETFs may not always be the best option.

The weightings of the various 10 industry sectors in the S&P 500 can change quite a bit over time. For instance, the weighting for the information-technology sector was 12.3 percent at the end of 1997. By the end of 1999, that weighting had increased to 29.2 percent. And by year-end 2002 the weighting had fallen almost all the way back to just 14.3 percent!

If you were an investor using the SPDR S&P 500 ETF to dollar-cost average at the end of each year, over 29 percent of your 1999 contribution would have gone into a sector that was clearly, in hindsight, in bubble territory. Conversely, when information-tech stocks got cheap again in 2002, only a little over 14 percent of your yearly contribution would have gone into that sector. To me, this seems like the opposite of dollar-cost averaging. The whole point of dollar-cost averaging is to buy more of an investment when it is cheap and less of an investment when it is expensive.

While the volatility in the information-tech sector is the most pronounced example, there are several other examples over the past couple of decades. Take, for instance, the financials sector, which went from a weighting of 13 percent in 1999 to over 22 percent in 2006, and then back down to 13 percent by 2008. Would you have allocated 22 percent of your investment dollars to the financials sector in 2006? Or the energy sector, which went from a weighting of under 6 percent in 2003 to over 13 percent in 2008, and back to about 6.5 percent today. Is the beaten-up energy sector, which has dropped more than 42 percent from its highs in mid-2014, worth more than 6.5 percent of your investment dollars today? I would certainly think so.

The problem with using index ETFs to dollar-cost average is that you are not allocating the same dollar amount to each industry sector. Instead, the current sector weightings determine how much of your annual (or quarterly or monthly) investment goes into each sector. This is a problem, particularly given the Fed's proclivity to produce booms and busts over the past 20 years. We've seen bubbles in technology, financials and energy shares in the past 20 years, and we're likely to see more in the years ahead. In short, the sectors that have gone up most and are most expensive will always get the majority of your new dollars while the sectors that have fallen most will get the least. It is pretty much "buying high."

This is just one of the reasons that tracking the sector weightings within an index like the S&P 500 can be a very informative tool for investors. While you obviously cannot predict precisely when an individual sector is topping or bottoming out, you can apply a little common sense and reduce allocations to those sectors that appear expensive (and vice versa). Active management isn't dead, it just needs more people to stick up for it!

Commentary by Michael K. Farr, president of Farr, Miller & Washington and a CNBC contributor. Follow him on Twitter @Michael_K_Farr.

For more insight from CNBC contributors, follow @CNBCOpinion on Twitter.