Script for expiration of pending orders at a preset price instead of time

I need, or at least think I need a script that would close a pending order IF a preset price is reached before the pending order has been executed.

It should be the same principle as expiry to date/time but with a set pricelevel instead.

An example of how I would use it may make it easier to see how it should work.

If I have a EURUSD trade going long with a TP at lets just say 1.38000 and a pending short order at 1.37900.
My pending order is a my hedgetrade in case my long trade turns against me…

Now…IF my long trade hits my TP I would like my pending order to expire because there is no long trade to protect anymore.
So a script that would allow me to set expiration to my pending order at the same price as TP for my long trade would be just what I’m looking for.

Does anyone know about any script/ea that could be used? I’ve searched a lot but not quite found what I am looking for.

and oh…happy easter :smiley: