Count number of Peak/Trough in a period

@zzDoanhzz,

See,