Index investing is an important issue for researchers and practitioners. This paper proposes an index portfolio optimization model for index investing via employing CSI 300 as underlying index. Firstly, a self-organizing neural network clustering model is constructed to complete the stock clustering based on stock trend which regards stock price as input. The index portfolio optimization model is proposed to determine the optimal investment proportion of each cluster sampling and achieve the minimum tracking error. The constraint BP algorithm is improved to benefit the optimization calculation of stock weights. Empirical results show that our approach achieves smaller tracking error and better index tracking effect than the random sampling.