News event monitor EA that closes/disables trading

Rene's trading Expert Advisors
Post Reply
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

News event monitor EA that closes/disables trading

Post by renexxxx »

  • UseNews: Overall On/Off switch for News Filter
  • CurrenciesToClose: Comma-separated list of currencies to watch/close. Leave blank for all.
    If this parameter is left blank, (High/Medium/Low-impact) news for any currency, will trigger the closure of all trades, at the specified number of seconds before the news release. If the parameter is set to eg. EUR,USD, it will only check for news items for these two currencies and if found, it will only close currency pairs that have either 'EUR' or 'USD' in their name.
  • CloseOnHighImpactNews: If true, act on HIGH impact news
  • CloseOnMediumImpactNews: If true, act on MEDIUM impact news
  • CloseOnLowImpactNews: If true, act on LOW impact news
  • NewsFilter: Additional filter to target specific news items. Note that string comparison is case-sensitive, so use the correct case.
  • CloseOpenTrades: If true, and there is upcoming news (as specified by previous parameters), close open trades. Again, the trades it will close will depend on the CurrenciesToClose parameter.
  • ClosePendingTrades: If true, and there is upcoming news, delete pending trades.
  • SecondsBeforeHighImpact: Specifies the time-window before the HIGH Impact news event, in which the EA must close trades. Only relevant if CloseOnHighImpactNews is true.
  • SecondsBeforeMediumImpact: Specifies the time-window before the MEDIUM Impact news event, in which the EA must close trades. Only relevant if CloseOnMediumImpactNews is true.
  • SecondsBeforeLowImpact: : Specifies the time-window before the LOW Impact news event, in which the EA must close trades. Only relevant if CloseOnLowImpactNews is true.
  • SecondsAfterHighImpact: Specifies the time-window after the HIGH Impact news event, in which the EA must close trades.
  • SecondsAfterMediumImpact: Specifies the time-window after the MEDIUM Impact news event, in which the EA must close trades.
  • SecondsAfterLowImpact: Specifies the time-window after the LOW Impact news event, in which the EA must close trades.
  • MagicNumberToClose: Specifies the MagicNumber of the trades to close. -1 means all magic numbers
  • DisableTradingOnNews: If true and it has been determined that there is upcoming news, disable "AutoTrading".
  • ReenableTradingAfterNews: If true and there is no upcoming news, make sure that "AutoTrading" is enabled.
  • BrokerGMTOffSet: GMT Offset in hours of the trade server. This is needed to convert the FFCal scheduled news times (which are listed in GMT) to trade server times.
Update v1.2 (2017.03.05)
The CloseOnNeewsEA has been updated such that it can optionally set a global variable that can be used by other EAs to stop initiating new trades. This way, you can avoid disabling AutoTrading completely (so you can set DisableTradingOnNews to false)
  • SetGlobalVariableOnNews: If true and it has been determined that there is upcoming news, set a global variable, with the name GvName, that can/should be used by other EAs to stop initiating new trades.
  • UnSetGlobalVariableAfterNews: If true and there is no upcoming news, remove the global variable named GvName.
  • GvName: The global variable name, to be used for communicating with other EAs.
Have fun!.

Update (LibFF.mqh) (2019.04.08): ForexFactory has apparently moved the xml file (temporarily?) to a new location. The new LibFF.mqh checks both the old and new location to find some data. A big "Thank You! :hi: " to Thomas for alerting me to this.

Update v2.1 (2021.03.26):Used the EasyXML library for parsing the xml file. Thanks go to Paul van Hemmen for creating this library.

Update (2021.07.16): Fixed a bug in EasyXML that was the reason that the xml-file was not downloaded in its entirety and therefore caused parsing problems further down the line.
You do not have the required permissions to view the files attached to this post.
bazze

News event monitor EA that closes/disables trading

Post by bazze »

Renesource Capital Empty4_Ink_LI.jpg
Thanks, renexxxx :good: ...BUT?
You do not have the required permissions to view the files attached to this post.
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

News event monitor EA that closes/disables trading

Post by renexxxx »

Not sure what's happening there.

Did you get any errors compiling the CloseOnNewsEA.mq4 file? You must have the necessary include files. Also, check that you have "Allow DLL imports" checked under Tools->Options, Experts Advisors.
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

News event monitor EA that closes/disables trading

Post by renexxxx »

SteveHopwood » Wed Jan 04, 2017 10:16 am wrote:I also got errors trying to compile the EA.
You probably have some .mqh files missing from the \Include folder. I have now added the .ex4 file to Post 1, so that you don't have to compile.
SteveHopwood » Wed Jan 04, 2017 10:16 am wrote:Anybody here got a simple way of taking Crapdows 10 screenshots so I can show what I am seeing?
I am using the "Snipping Tool", that comes with Windows 10. You can get to it by typing SNI in Cortana. I'm sure there are other ways too.

R.
bazze

News event monitor EA that closes/disables trading

Post by bazze »

Thanks :) ...
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

News event monitor EA that closes/disables trading

Post by renexxxx »

Alex1055 » Fri Jan 06, 2017 8:34 am wrote:Did Rene"EA working on a Robot EA?Thanks for reply.
I have got no idea what this means. Please rephrase to make yourself understood.
luke
Trader
Posts: 17
Joined: Fri Aug 14, 2015 7:03 am

News event monitor EA that closes/disables trading

Post by luke »

Hi renexxxx - thanks for this!

I'm also missing one of the include files, mql4-http.mqh is referenced in LibFF.mqh. A google search turned it up here: https://github.com/sergeylukin/mql4-htt ... 4-http.mqh

Is that the correct version to use?
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

News event monitor EA that closes/disables trading

Post by renexxxx »

luke » Sun Jan 08, 2017 8:58 pm wrote: I'm also missing one of the include files, mql4-http.mqh is referenced in LibFF.mqh. A google search turned it up here: https://github.com/sergeylukin/mql4-htt ... 4-http.mqh
My mistake.

All these include files were already attached in this thread, so I didn't bother to attach them here as well. But I have now also included mql4-http.mqh to Post 1 of this thread. Both files are identical.

Hope you can compile now ... if not, you still have the option to use the .ex4 file.
deadman
Posts: 8
Joined: Fri Feb 05, 2016 5:07 pm

News event monitor EA that closes/disables trading

Post by deadman »

Hi Rene,

thank you very much for the EA. It is very helpful. Would it be possible for the further releases to show the upcoming news in the chart window? That would be super useful.

Thanks again!
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

News event monitor EA that closes/disables trading

Post by renexxxx »

deadman » Mon Jan 09, 2017 12:11 am wrote:Would it be possible for the further releases to show the upcoming news in the chart window?
You can just load the FFCal Indi on the chart. Both the EA and FFCal Indi are using the same news feed.

Hope this helps.
Post Reply

Return to “Auto-trading EA's and EA monitors”