Help with trend sensor for speed

Dear all, i’m implementing a trend sensor to fire an event if speed (in km/h) has a rapid deceleration in 2 seconds… for example: supposing to drive at X km/h, if its value change in a new value between -3 and -10 Km/h in 2 seconds = crash event… my problem is that I can’t get on with creating the template…
Someone could point me in the right direction??? Thanks a lot.

binary_sensor:
  - platform: trend
    sensors:
      speed_down:
        entity_id: sensor.speed