Accurate identification of R-peaks is the basis of ECG correlation analysis. In this paper, we propose a method that first enhances the features of R-peaks using difference-square operations, and then locates R-peaks by threshold detection, slope judgment and backtracking search, where the threshold is a set of combined thresholds that are related to R peak amplitude, R-R interval and noise, respectively. The algorithm was tested on the MIT-BIH arrhythmia database, and the sensitivity Se = 99.59%, while the positive prediction rate +P = 99.71%. The method shows robustness with the addition of different noise levels. The experimental results show that the proposed algorithm reduces the false detection rate and increases the recognition rate, takes into account the real-time and anti-interference performance, and is suitable for the correlation analysis of ECG.