How to use economic calendar data in MQL EA?

Recently, the MT5’s toolbox has a new item, “economic calendar”.

Are there functions that could handle the “economic calendar”?

Any information will be appreciated.

There aren’t at this moment.

ok, thank you very much.

There aren’t.

But you can get all objects OBJ_EVENT on the chart and try to find some information from name of object and description. It might be helpful.

void OnStart()
   long cid=ChartID();
   int ot=ObjectsTotal(cid,0,OBJ_EVENT);
   Print(ot," objects found.");
   for(int i=0;i<ot;i++)
      string name=ObjectName(cid,i,0,OBJ_EVENT);
      Print(name,": ",ObjectGetString(cid,name,OBJPROP_TEXT));

Sure we can, however this is kind of “brute-force” method. Would be much more efficient to have direct access to such objects with dedicated functions.

This is useful. However, we did need direct access …

In fact, I asked this question about one year ago when I would like to use my related strategy in my EA. And I believe that many other users also want to use news in their EA. Hope they could come out.

Which brokers currently have the calendar tab in the toolbox?

I can’t seem to find any metatrader platform(especially demo) yet they all have this feature described in the manual.

Does anyone have any recommendations?

MetaQuotes : are there any new plans on implementing functions dealing with economic calendar events? This could be useful e.g. to create a strategy based on particular data values related to economic events, displayed in calendar tab - because with a method presented by pdeeny we can only find an event, without having direct access to its properties (only e.g. by parsing object description, which isn’t very comfortable way).

Documentation on MQL5: Standard Constants, Enumerations and Structures / Objects Constants / Object Properties
Standard Constants, Enumerations and Structures / Objects Constants / Object Properties - Documentation on MQL5

I am still hoping for a dedicated solution in MQL5 that would implement what I have mentioned before.

It is possible to use economic data in MQL since build #344. You can see an example here"

Thanks @mql5com that was exactly what i wanted. When i get the data using CalendarEventByCountry, I can also get the importance as a number. But I’m not sure if a higher value indicates higher importance? or is it vice versa. For example, if we get two events, one with importance of 3 and one with importance of 2, which one is more with impact ? Thank you :cowboy_hat_face:

Importance is a subjective assessment. You yourself must analyze each event.


1 Like

ok so importance is subjective. Got it thanks