In this paper, the stock index time series forecasting using optimal neural networks with optimal architecture avoiding overfitting is studied. The problem of neural network architecture selection is a central problem in the application of neural network computation. After analyzing the reasons for overfitting and instability of neural networks, in order to find the optimal NNs (neural networks) architecture, we consider minimizing three objective indexes: training and testing root mean square error (RMSE) and testing error variance (TEV). Then we built a multi-objective optimization model, then converted it to single objective optimization model and proved the existence and uniqueness theorem of optimal solution. After determining the searching interval, a Multi-objective Optimization Algorithm for Optimized Neural Network Architecture Avoiding Overfitting (ONNAAO) is constructed to solve above model and forecast the time series. Some experiments with several different datasets are taken for training and forecasting. And some performance such as training time, testing RMSE and neurons, has been compared with the traditional algorithm (AR, ARMA, ordinary BP, SVM) through many numerical experiments, which fully verified the superiority, correctness and validity of the theory.