Not off top of head sorry, it would be quite simple to write though.
Have 2 inputs, EntryPrice and TPLevel.
Loop through the open orders and look for an entry with the entry price of the order you want to monitor. When it finds it check current price against TPLevel and close half if the price...