Heart stimulating device comprising a stimulation pulse generator arranged in a stimulator housing, where the heart stimulating device is coupled to a plurality of stimulation and sensing electrodes arranged at one or many leads, the electrodes being adapted to be arranged in connection with the heart to stimulate the heart. The device further comprises a sensing unit adapted to sense electrical heart tissue responses to applied electrical stimulation pulses via said electrodes. The pulse generator is adapted to generate stimulation pulses to be applied to the heart tissue by different electrodes, and for each of the applied pulses resulting in a depolarization wave in the heart tissue a depolarization wave velocity parameter of the wave is determined by the sensing unit and stored in a memory unit. The stored wave velocity parameters, related to different stimulating electrodes, are compared to each other in a comparison unit and the comparison is used to adapt a stimulation mode when stimulating the heart to optimize the hemodynamic performance of the heart.