Code for an MT4 EA that uses Trailing Stop

I'm new with trading and MQL4. I'm looking for an MQL4 code for an EA that uses the trailing stop closing price as the trigger to open a trade in the opposite direction.
Example:
Say you have a "SELL" trade open and have a trailing stop on this trade and want to have a pending "BUY" order with a specific SL that will execute once the active "SELL"trade is closed by the trailing stop. Hope this is clear enough for someone to help.
Thanks
Example:
Say you have a "SELL" trade open and have a trailing stop on this trade and want to have a pending "BUY" order with a specific SL that will execute once the active "SELL"trade is closed by the trailing stop. Hope this is clear enough for someone to help.
Thanks