Cutloss or take profit when adding LP

Can you make smart contract that can automatically withdraw LP when price go down or up 50% for example.
It can protect people from rugpull.