The advent of telehealth applications and remote patient monitoring has led to an increasing need for continuous signal quality monitoring to ensure high diagnostic accuracy of the recordings. Cardiovascular diseases often manifest electrophysiological anomalies, therefore the electrocardiogram (ECG) is one of the most used signals for diagnostic applications. Various types of noise and artifacts are not uncommon in ECG recordings and assessing the quality of the signal is essential prior to any clinical interpretation. In this study, a dynamic signal quality index (dSQI) is introduced using a new time-frequency template-based approach. Approach: A smoothed pseudo Wigner-Ville transform is applied to derive the time-frequency patterns of the ECG signal. A weighted cross correlation function then assigns a score between 0 to 1 to each identified ECG beat to indicate the signal quality. It evaluates the consistency of the patterns over an ECG window of multiple beats. To assess the performance of the dSQI, the algorithm was tested with the public databases on PhysioNet, alongside other state-of-the-art indexes for comparison. The recordings were classified into noisy and normal recordings, as well as noisy data versus the recordings from patients with heart diseases and abnormal rhythms. Main results: The results showed that dSQI outperformed previous metrics when used individually with an area under curve (AUC) of 93.18% for normal versus noisy and 93.69% for abnormal versus noisy. A support vector machine was also trained with different combinations of dSQI and other signal quality indexes, where dSQI showed to be among the best performing sets in classifying both normal versus noisy (97.4% on training set and 96.9% on test set) and abnormal versus noisy (97.6% on training set and 96.3% on test set). The method was also tested on the MIT-BIH Arrhythmia Database to evaluate dSQI in common arrhythmia cases. Significance: The results indicate that dSQI provides a more accurate and continuous scalar metric for beat-by-beat ECG quality assessment, even for those with arrhythmia.