I was thinking using a TMF: you know all the variables of the specific trade (ENTRY,.. STOP... TRAIL,.... You can make all the required calculations and take actions.