Detect if upcoming news and stop trading

 

Hi,

Is there a function out there that scans forex factory for upcoming news and if there is, it will not trade? 

I'm trying to code an EA to have the ability to know if there is upcoming news and if yes, how many minutes away, and if it's high risk news.