Considering the influence of the ionosphere, troposphere, and other systematic errors on double-differenced ambiguity resolution (AR), we present an optimal triple-frequency code-phase combination determination method driven by both the model and the real data. The new method makes full use of triple-frequency code measurements (especially the low-noise of the code on the B3 signal) to minimize the total noise level and achieve the largest AR success rate (model-driven) under different ionosphere residual situations (data-driven), thus speeding up the AR by directly rounding. With the triple-frequency Beidou Navigation Satellite System (BDS) data collected at five stations from a continuously-operating reference station network in Guangdong Province of China, different testing scenarios are defined (a medium baseline, whose distance is between 20 km and 50 km; a medium-long baseline, whose distance is between 50 km and 100 km; and a long baseline, whose distance is larger than 100 km). The efficiency of the optimal code-phase combination on the AR success rate was compared with that of the geometry-free and ionosphere-free (GIF) combination and the Hatch-Melbourne-Wübbena (HMW) combination. Results show that the optimal combinations can always achieve better results than the HMW combination with B2 and B3 signals, especially when the satellite elevation angle is larger than 45 • . For the wide-lane AR which aims to obtain decimeter-level kinematic positioning service, the standard deviation (STD) of ambiguity residuals for the suboptimal combination are only about 0.2 cycles, and the AR success rate by directly rounding can be up to 99%. Compared with the HMW combinations using B1 and B2 signals and using B1 and B3 signals, the suboptimal combination achieves the best results in all baselines, with an overall improvement of about 40% and 20%, respectively. Additionally, the STD difference between the optimal and the GIF code-phase combinations decreases as the baseline length increases. This indicates that the GIF combination is more suitable for long baselines. The proposed optimal code-phase combination determination method can be applied to other multi-frequency global navigation satellite systems, such as new-generation BDS, Galileo, and modernized GPS.