Firstly the amounts you can access currently are the ones on the screen ... back_amount, back_amount2 & back_amount3.
I would have a back trigger and a cancel trigger. Below is typed and not validated, but should give you an idea to work on.
All matching selections
Price:
IF(back_amount > 1000, r_ticks(back_price, 1),IF(back_amount2 > 1000, r_ticks(back_price2, 1),IF(back_amount3 > 1000, r_ticks(back_price3, 1), 0) ) )
Condition:
IF(back_amount > 1000, r_ticks(back_price, 1),IF(back_amount2 > 1000, r_ticks(back_price2, 1),IF(back_amount3 > 1000, r_ticks(back_price3, 1), 0) ) ) is greater than 0
selections number of unmatched lay_bets is equal to zero
Cancel anything not matched after 5 seconds.
Cancel Trigger.
Condtion:
bu_backtime is less than nowtime - (mf_second * 5)