In an implantable medical device, such as a pacemaker or a cardioverter/defibrillator, and a method for operating such an implantable medical device, heart conditions, such as heart failure, are detected and predicted at an early stage within a patient in whom the medical device is implanted, by monitoring a patient status, for example, HF status, and predicting a worsening of the HF status of the patient and determining a patient status index, wherein a first average and a second average is compared at predetermined sample points of time. A patient status is determined based on this patient status index, wherein a patient status index that has increased substantially monotonously during a first monitoring period is determined to be an indication of an exacerbation of patient status, and in particular, a worsening of heart failure.