Nice article and well-crafted code.
I liked the approach you followed to get the broker's DST type through the price reactions to NFP of united states on EURUSD charts, it works flawlessly.
I tested also the dst adjustments of non-farm payrolls (NFP) events of united states on multiple brokers (DST_NONE, DST_UK and DST_US) and it showed that they are calculated properly inside the method CDaylightSavings_AU::adjustDaylightSavings() and its siblings in the other two classes. However, the performance of the process to identify daylight times can be boosted greatly by directly calculating the dst switch times using mathematical equations instead of the linear search through CArrayObj() of the hard-coded values. See here.
Also note that that SymbolInfoString(SymName,SYMBOL_CURRENCY_BASE) can fail on some brokers that do not configure that property correctly on their servers (they "wrongly" set the base currency of EURUSD to USD instead of EUR), so it is more safe to use StringSubstr(SymName,0,3).
Thanks.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Check out the new article: News Trading Made Easy (Part 1): Creating a Database.
News trading can be complicated and overwhelming, in this article we will go through steps to obtain news data. Additionally we will learn about the MQL5 Economic Calendar and what it has to offer.
In this article, we will learn to create a database in which we will store data from the MQL5 Economic Calendar. This data can be used later, in upcoming articles, to trade the news. We will also explore how to execute basic SQL queries to retrieve certain organized information from this database. The entire process will be done in the MQL5 IDE.
Traders keep a close watch on news sources for information that might impact the markets. This includes geopolitical events, corporate earnings announcements, political events, and economic reports such as GDP growth or employment figures. Traders act quickly to respond to significant news releases to profit from resulting market changes. Depending on how the news is interpreted, buying or selling assets may be necessary. In this article, we will focus on economic events, as they are readily available to us through the MQL5 Economic Calendar.
A database is a structured collection of data that is electronically stored and accessed. Databases can efficiently manage and store vast amounts of data, enabling various activities like data analysis, storage, and management. In MQL5, we work with SQLite databases which are created and managed by the SQLite database engine. SQLite databases can have any file extension, but usually, they are single disk files with .sqlite, .sqlite3, or .db extensions. These files contain all the data and structure present in databases, including tables, triggers, indexes, and other metadata.
Databases are perfect for handling large datasets and simplify the process of retrieving data from a particular date or event, without the need for complex loops. Moreover, the MQL5 economic calendar is inaccessible in the strategy tester. So, if you want to test your strategy based on news, how would you do that?
Author: Kabelo Frans Mampa