Closing a trade at MA crossing

 
currently, I trade a 15 minute chart and it works great for me. But I do not always have the time to watch a trade all the way through to my exits. I currently trade manually(although I have written a holy grail that doesn't work... naturally). My strategy requires that I stay in a trade until my stops are reached or one of my MA's crosses the other. Can I exit a trade using a script or EA(or a combination of the two) when these MA's cross when the EA/script did not open the trade?
 
Yes.
Reason: