In Addition, I choose the - not the for this script.
If you get a trade Signal, then set an sell- oder buy-order on the high or low. If the next bar doesn't touch into the trade, then delete your order.
Have fun and good look.
In addition, you can see the code to modify on your own wishes.