A method includes storing an electrogram (EGM) template in a memory. The EGM template includes first and second alignment points at first and second peaks of the EGM template, respectively. The method further includes identifying first and second peaks of a cardiac cycle EGM acquired by a medical device and selecting one of the first and second peaks of the cardiac cycle EGM to align with one of the first and second alignment points based on an order in which the first and second peaks of the cardiac cycle EGM occur. Additionally, the method includes aligning the selected one of the first and second peaks with one of the first and second alignment points and determining an amount of similarity between the cardiac cycle EGM and the EGM template after alignment.