There are at least 2 ways.

One way is under "on Tick" - something like: No trade is running -> Check last closed trade profit -> Delete pending orders The other way is under "on Trade": (on trade) Trade closed -> Condition (where you will check the profit, use (on trade) category) -> Delete pending orders

I think I prrefer the first way, because in MT4 for "on Trade" to work extra resource is needed, but only if you have some blocks there đŸ™‚