The present invention relates generally to implantable medical devices and more particularly to systems and methods for automatically determining ST windows for ischemia detection. At least one IEGM signal is obtained representative of cardiac behavior of a patient over a period of time and followed by calculating a derivative signal of the IEGM signal. The R-wave is identified in the derivative signal and the derivative signal data following the identified R-wave is analyzed so as to find portions of the derivative signal comprising samples having lower values than a predetermined threshold. Further, a portion of the derivative signal including samples having lower values than the threshold is determined to correspond to a ST window for that cardiac cycle if that portion fulfills predetermined requirements. A reference ST window based on a number of determined ST windows is determined. Using the reference ST window, ischemia can be detected by comparing IEGM data in the reference ST window with current IEGM data from a segment of the IEGM signal corresponding to the reference ST window.