In this paper, we address the problem of long-term investment by exploring optimal strategies for allocating wealth among a finite number of assets over multiple periods. Based on the classical Markowitz mean-variance philosophy, we develop a new portfolio optimization framework which can produce sparse portfolios. The sparsity of the portfolio at each and across periods is characterized by the possibly nonconvex penalties. For the constructed nonconvex and nonsmooth constrained model, we propose a generalized alternating direction method of multipliers and its global convergence to a stationary point can be guaranteed theoretically. Moreover, some numerical experiments are conducted on several datasets generated from practical applications to illustrate the effectiveness and advantage of the proposed model and solving method.