Basically, your trading rules are events triggering the trade.
So it already does what you want.

To answer the question try to be more specific, what kind of event, e.g. Trump tweets?