Long-term fetal heart rate (FHR) monitoring is necessary to ensure that any FHR abnormality, which may appear at any time during pregnancy and labor, can be detected. An ambulatory electrocardiogram (ECG) recorder employing three abdominal surface electrodes has been developed towards achieving such a monitoring. The difficulties encountered in determining the FHR from the maternal abdominal signal are mainly the interference due to the electromyogram and motion artifact, and relatively small amplitude of the fetal ECG compared to that of the maternal. Thus improvement to existing abdominal signal processing algorithm is necessary to increase the percentage of successful monitoring. A real-time algorithm has been developed for the simultaneous measurement of the fetal and maternal heart rates from the abdominal signal. The algorithm is based on digital filtering, adaptive thresholding, statistical properties in the time domain, and differencing of local maxima and minima. A filtering technique has been utilized in the proposed algorithm to extract the fetal signal from the maternal abdominal signal. This is an alternative to a previous method which subtracts the maternal complexes from the abdominal signal with a need to overcome the problem of matching a template to the complexes. The proposed algorithm is capable of continuous ambulatory FHR monitoring either off-line, by using recorded signals, or on-line by a clinician during antenatal examination. The performance of the algorithm has been evaluated of the heart rates tracing processed from the abdominal signals. The resulting average accuracy is 83% for the FHR detection. The detection of the FHR from the maternal abdominal signal by the developed algorithm has also been compared with a short-term monitoring commercial instrument IFM-500 for the assessment of the reliability of the algorithm. The performance achieved from the comparison shows non-significant differences of means, low error percentages and linear correlation coefficient. A portable system based on the developed algorithm has the potential for increased percentage of real-time FHR detection thus enabling successful long-term fetal monitoring