Detection and tracking of the P-and T-waves are important issues in the analysis and interpretation of the ECG signals. This paper addresses the problem by using two mixture Gaussian function and the Dynamic programming. A key feature of the proposed algorithm is that it allows to incorporate the prior knowledge about the P/T wave location variations and robustness to errors in QRS detection. The proposed algorithm is evaluated on the annotated QT-database and compared against the algorithms based on differential evolution optimization strategy (DEOS) and generating blocks of interest (GBI). The experiments show that the proposed method determines the P-and T-peak locations with a root mean square error of 0.085 s and 0.091 s respectively. Both these values are better than the corresponding values from DEOS and GBI. Similarly, the proposed algorithm achieves a sensitivity of 96.13% and predictivity of 97.70%. While the predictivity is higher than both DEOS and GBI, the sensitivity is on par with GBOI and higher than that of DEOS.