The issue of behavioral finance is one of the new debates raised by some financial pundits over the past two decades. The unknown factors affecting stock price changes are always a reason to use stock price prediction. In most predictive models, the system performs prediction using only one indicator, but in the proposed model in this study, a two-level system of multilayered perceptron neural networks is presented, which uses several indicators for prediction. In this study, required information of Tehran stock exchange price indicators, for fiscal years 2012-2017 was collected. In order to analyze the financial behavior, after examining the effect of each behavioral factor on the investment of financial assets, the results show that all factors other than "over-confidence" affect investment, but the effectiveness of each factor, including "relative profit and loss", " disposition effect", "conservatism", "herd behavior", " representativeness", " ownership" and " regret aversion" is different. Among these factors, the "relative profit and loss" has had the most impact on the investment of financial assets in the stock exchange, and the " regret aversion" has the least, which proceeding a direct impact on the stock price index. Also, for better training of the neural network and consequently improving the results, grasshopper optimization algorithm is used to select the best samples. The results show that the proposed model could have lower predictive error than other models.