How to Detect a Pattern

So something like the following ;

if (force > 50) {

while ((change in time ) < 1000) {

if ( force < -50){
// turn motor on for given time;
}
}

my thinking of above is that if force goes to 50 and then within 1 second it goes to -50 then the motor will turn on.

I have a feeling though that the while loop will just close off after 1 second no matter what?