Not sure if this is what you are looking for.... found these articles on an EA that trades news events. Have a look, seems interresting:
https://www.mql5.com/en/code/8491 - maybe download this EA and indicators first.
https://www.mql5.com/en/articles/1502 - then read this article carefully on how to set the above up
Please don't go and run this on your live account. I suggest trying it out on demo first. Have not checked this out myself (too busy with a battle with my own EA :), but still want to.
The code in this EA may give you ideas on how to incorporate and use economic calendar data in your EA. Please not this is based on MetaQuotes/MetaTrader software.
Let me know if you got it working. Good luck!
:)
Keep it simple, be disciplined, get rich slowly and above all protect your equity!