I would like to help you code this EA. But, in order to do that, you're going to have to help me understand how you calculate your pivot points. Do you use a daily time frame to calculate them? Do you have a limit on the number of trades? Do you have opposite positions open at any time? Do you have a NORMAL stop loss or do you only use the trailing stop? Is there a take profit? I know that's a lot of questions, but in order to automate this thing, I need to know EVERYTHING! Give any other details that you think are important.
It would probably be easiest though, if you gave a few example trades so I can get a clear understanding of how this system works.