A system for ischemia detection comprising: a data collection module configured to obtain at least one IEGM signal indicating cardiac behavior of a cardiac cycle corresponding to a heartbeat; a data processing module configured to calculate a derivative signal of the IEGM signal; a detector configured to identify a R-wave in the derivative signal or in the IEGM signal, characterized by: an ST window determining module configured to: analyze said derivative signal data following said identified R-wave so as to find portions of said derivative signal comprising samples having lower values than a predetermined threshold; determine a portion of said derivative signal including samples having lower values than said threshold to correspond to a ST window for that cardiac cycle if that portion fulfills predetermined requirements comprising: a predetermined number of samples in said portion has a value below said predetermined threshold; a predetermined number of samples having values below said threshold are consecutive; and the portion has a length exceeding a predetermined time interval; and create a reference ST window based on a number of determined ST windows; and an ischemia detection module configured to detect ischemia by comparing IEGM data in said reference ST window with current IEGM data from a segment of a current IEGM signal corresponding to the reference ST window. a data collection module configured to obtain at least one IEGM signal indicating cardiac behavior of a cardiac cycle corresponding to a heartbeat; a data processing module configured to calculate a derivative signal of the IEGM signal; a detector configured to identify a R-wave in the derivative signal or in the IEGM signal, characterized by: an ST window determining module configured to: analyze said derivative signal data following said identified R-wave so as to find portions of said derivative signal comprising samples having lower values than a predetermined threshold; determine a portion of said derivative signal including samples having lower values than said threshold to correspond to a ST window for that cardiac cycle if that portion fulfills predetermined requirements comprising: a predetermined number of samples in said portion has a value below said predetermined threshold; a predetermined number of samples having values below said threshold are consecutive; and the portion has a length exceeding a predetermined time interval; and create a reference ST window based on a number of determined ST windows; and an ischemia detection module configured to detect ischemia by comparing IEGM data in said reference ST window with current IEGM data from a segment of a current IEGM signal corresponding to the reference ST window. an ST window determining module configured to: analyze said derivative signal data following said identified R-wave so as to find portions of said derivative signal comprising samples having lower values than a predetermined threshold; determine a portion of said derivative signal including samples having lower values than said threshold to correspond to a ST window for that cardiac cycle if that portion fulfills predetermined requirements comprising: a predetermined number of samples in said portion has a value below said predetermined threshold; a predetermined number of samples having values below said threshold are consecutive; and the portion has a length exceeding a predetermined time interval; and create a reference ST window based on a number of determined ST windows; and analyze said derivative signal data following said identified R-wave so as to find portions of said derivative signal comprising samples having lower values than a predetermined threshold; determine a portion of said derivative signal including samples having lower values than said threshold to correspond to a ST window for that cardiac cycle if that portion fulfills predetermined requirements comprising: a predetermined number of samples in said portion has a value below said predetermined threshold; a predetermined number of samples having values below said threshold are consecutive; and the portion has a length exceeding a predetermined time interval; and a predetermined number of samples in said portion has a value below said predetermined threshold; a predetermined number of samples having values below said threshold are consecutive; and the portion has a length exceeding a predetermined time interval; and create a reference ST window based on a number of determined ST windows; and an ischemia detection module configured to detect ischemia by comparing IEGM data in said reference ST window with current IEGM data from a segment of a current IEGM signal corresponding to the reference ST window.