Abstract: Neural network algorithm is very suitable for stock prediction as a model for dealing with complicated relationship. However, the prediction accuracy of neural network algorithm depends largely on the number of hidden nodes and the terminal condition. To follow up the changes in stock prices, a new method is proposed in this study to find out the optimal parameter. The recommended solution is setting fewer hidden nodes and lower holdout percentage. Results show that the proposed method can lessen about 60% of the forecast error such that it can ensure the efficiency and accuracy of the algorithm.