Disclosed herein are systems and methods for automatically determining ST windows for ischemia detection. In one example, an R-wave is identified in a signal derived from an IEGM 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.