Need ea Modified

I will try to explain this the best I can. I have enclosed an ea that maybe can be modified
I need an ea that will first close all orders at profit
second a trailing stop added
third a close orders at loss in pips
fourth read below I tried to explain the best I can. NOTE: this needs to all be in pips not dollars like 0.5 etc.
Here seems to be the tricky part when the ea hits the trailing stop at whatever i input lets say 20 pips, now I want the option lets say the market goes the other direction against me. I want to be able to have the ea close a percentage of the order say at 10 pips. This way if it does go to 0 I at least get something out of the market. This would be great for scalping for all of us. Maybe somebody can you look at this. I have enclosed a trailing ea maybe you can just add to it.
Thanks let me know what you think.

[B]So the inputs would be
All possessions[/B] True or False
Profit Trailing True or False
[B]Trailing stop[/B]
[B]Profit Target[/B]
[B]Trailing Step[/B]
[B]Hard Stop[/B]

Then Close Partial oreder( This is when the trailing stop has been hit here you would add the amount of order to close if the trailing stop heads back to 0)
Close order amount This is when the trailing stop has been hit here you would add how many pips before it closes the partial order.

[B]What I am getting at is lets say you go long eur/usd and you set your trailing stop at 10 ok so you hit the trailing stop and then the market reverses and lets say you want the ea to close half the order at 5 pips you still gain if it goes to 0.[/B]

Thanks much