PIR and resetting counter

I am using a PIR to start a couple of counters, when the PIR is high i want it to trigger counter_swipe to begin increasing, when counter swipe is more than 320 i want it to begin increasing count_swipel, once count_swipel reaches more than 450 i want everything to return and hold at 0, however at the moment this will loop whilst the bounce boolean is high, so whilst the sensor is high the counters reset and begin counting again, as soon as it goes low the counters stop. How can i make this happen so it triggers the event then continues regardless of the sensor and stops regardless of the sensor.

here is what i have so far

if (digitalRead(pirpin) == HIGH){
bounce = true;


}



 if (bounce) {

    
  count_swipe ++;
  r_l();

  
  if (count_swipe >= 320){
  
  count_swipel++;
  l_r();
  }
  }

  
 if ((count_swipel>450)){
  bounce = false;

  tracker = 0;
  count_swipe = 0;
  count_swipel = 0;
  
 }

You need to look at the state change detection example. You want to start the weird counting process when the PIR state BECOMES (not IS) HIGH.