Comparing two output

if you take a look at the figure that i have posted , you can see that the value of " Tx " jumps from 1506 to 1516 at spikes. so the current value (" Tx ") is bigger than the last one (" f ") at spikes
and i want to count the spikes.