detrending in real time
What is the nature of the trend?

If the trend is due to DC drift (perhaps due to the signal acquisition apparatus), you may be able to remove it with a simple high-pass filter around 0.1 - 0.5 Hz. This would eliminate the need for any real-time post-processing.

DC drift gives a slowly rising/falling DC component, such as in the first figure here: