How to get discrete values from a nosiy data set that have a trend?
From the comments you are most interested in counting the number of clear up areas over a certain duration of time, and you point out that you will have occasional erroneous negative spikes even during the up intervals.

You obviously want to filter but you also suggested little knowledge in this space so I will keep it very simple in what should provide a reasonable result.

My suggestion is to do a moving average over the minimum duration you ever expect for an up interval. Pass your waveform through the moving average, and then on the filtered output set a threshold detector with hysteresis (two thresholds) such that you increment your Up counter when passing the upper threshold and then allow your counter to trigger again once your lower threshold is set. Adjust your threshold levels for best results based on your actual signal cases.