Economic Calendar trading

 

Hello, I have a question about newly introduced Calendar in MQL5. Is it only used for closing open orders before the economic news?

Or it can be used for opening new orders depending on the content of the news?

I mean, does the news contain actual figures rather than planned event data?

For ex, if on Sep 25, 2025, there is a planned event, then is it included into the Calendar as a planned event first of all?

And then when Sep 25, 2025 arrives, when actual figures are announced, do these actual figures update the calendar record again?

Will this record of the calendar be delivered to MQL5 base using these updated figures for us to open new orders (or close existing ones), using these actual figures?

Please explain it and if you have any code passage, please share it here.

Regards

Bahman Asgarov

 
Yes, planned events update with actual figures at release. Use CalendarEventById() and CalendarValueLastByEvent().
 
Bahman Asgarov:

Hello, I have a question about newly introduced Calendar in MQL5. Is it only used for closing open orders before the economic news?

Or it can be used for opening new orders depending on the content of the news?

I mean, does the news contain actual figures rather than planned event data?

...

Please explain it and if you have any code passage, please share it here.

Not a code passage but, if you wish you can check an example of the CalendarTrading EA from the book (the EA uses custom classes CalendarFilter and CalendarCache, which simplify writing news-related EAs but requires preliminary studying and understanding). It can use online calendar or a cache of it in the tester (the cache file should be prepared beforehand, that is saved from online, then it can be loaded and used in the tester up to the moment of saving, because the later news will be changing online). For proper DST correction use the updated codes from the Economic Calendar Monitor and Cache in the codebase.

MQL5 Book: Advanced language tools / Economic calendar / Calendar trading
MQL5 Book: Advanced language tools / Economic calendar / Calendar trading
  • www.mql5.com
There are many news trading strategies: with market or pending orders, with analysis of financial indicators (the direction of price movement), and...