Measuring local "flatness"
You can run the signal through a low pass filter to get rid of the high frequency content. After that, if you know the expected length of the flatness of the signal, you can perform matched filtering with a template of that length. If the cross-correlation result exceeds some threshold, consider the signal detected.