1. A method comprising: generating an electrocardiogram (ECG) signal of a patient via one or more medical leads attached to the patient; sampling the ECG signal at a plurality of sample times over each of a plurality of T-waves for each of a plurality of beats to obtain a sample point from each of the T-waves for each of the sample times; determining a plurality of ECG-based T-wave alternans (TWA) values, wherein each of the ECG-based TWA values is determined from the sample points from each of the T-waves associated with a respective sample time during each of the T-waves; determining one of the plurality of sample times associated with a largest one of the ECG-based TWA values; selecting an interval based on the sample time associated with the largest one of the plurality of ECG-based TWA values; generating an electrogram (EGM) signal of the patient using an implantable medical device; storing one or more samples of the EGM signal per heartbeat of the patient for a plurality of heartbeats, wherein for each heartbeat a stored sample is an amplitude of a T-wave that occurs after a fiducial point of the EGM signal by an amount of time equal to the selected interval; and determining an EGM-based TWA value based on the T-wave amplitudes of the EGM signal.