Monitoring mangroves is critical to protect the coastal ecosystems. Some studies resorted to remote sensing for constructing mangrove indices (MIs). However, there are still some drawbacks in existing MIs. On the one hand, difficulty still persists in distinguishing mangroves from non-mangrove vegetation and non-vegetated areas at the same time. On the other hand, the existing MIs have not fully utilized the phenological trajectories, which can greatly help to distinguish mangroves from other land covers. To overcome these issues, we built a novel mangrove index, namely generalized composite mangrove index (GCMI) by compositing vegetation indices (VIs) and water indices (WIs) based on Sentinel-2 time series data. Firstly, to determine the optimal indices, a similarity trend distance (ST distance) measure was proposed based on Pearson correlation coefficient and dynamic time warping (DTW). Secondly, in order to optimize the weights of selected indices, a population reconstruction genetic algorithm (PRGA) was designed. Finally, mangroves were mapped by feeding the time series of GCMI into random forest (RF) classifier. Experiments conducted over three areas along the southern coast of China demonstrate that: 1) GCMI enhances the separability between mangroves and other land covers compared to the existing VIs, WIs, and MIs, with an averaged OA of 91.45%; 2) ST distance outperforms Euclidean distance, Cosine distance, Pearson correlation coefficient, and DTW in optimizing the weights of GCMI; and 3) PRGA greatly improves the probability of attaining global optimal result. The innovation lies in the presented GCMI considering both the vegetation trajectory information and water inundation using time series.