Need critical help: How to detect and distinguish two very similar looking signals? Hi guys I have a really tough signal processing question here. 

How do you detect and distinguish two very very similar looking waves?

I need to distinguish between these two signals for an online application and the techniques so far have all failed. These two signals have very similar and often unpredictable amplitudes. Almost identical frequency. So the only way I can attempt to distinguish between the two is using time domain features.

Signal 1:


Signal 2:


The data is streamed live in every single second (at 128 samples per second). My approach is to:


use a window of size 128 samples to obtain the data
Calculate the time domain features of the data 
features such as: 


derivative between the mean of the current 128 samples and previous
128 samples, 
derivative between the max point of the current 128 samples and
previous 128 samples
skewness of the data
kurtosis of the data
deviation from the mean

If derivative goes down, then we say it is signal 1 and if derivative does down we say it is signal 2


But the problem is that the two signals look very very similar. So if the window is incorrectly placed (i.e. on the rising or falling phase after the initial signal), then it can give me the complete opposite result!

Can someone give me some suggestions as to what features I should use or what technique I should use to distinguish between this two very similar looking signals!
As Conrad pointed out, a correlator is probably your best bet.

The correlation of a signal with itself (also known as its self-similarity) is larger than its correlation with any other signal (except for a constant factor related to the signals' energy).

In your case, you would implement two correlators, one for Signal 1 and one for Signal 2. Then, you'd look for one of the correlators' output to be larger than a certain threshold. You may have to run a few tests to determine the threshold.

One nice benefit of using correlation is that you don't need to synchronize your time window to the signals. Just be sure to accumulate the correlation calculations from one time window to the next.