- Auto trading the news
- getting data from websites
- [Branch closed!] EURUSD - Trends, Forecasts and Consequences (Episode 4)
Hi everybody. How can I incorporate fundamental economic data (Such as"actual", "forecast" or "previous" data of a news release) into anExpert Advisor? Which platform (MT4 or MT5) has that capability? Whatfunction() to call in MQL4 or MQL5 such data from a website such asForex Factory? Thank you in advance.
You will have to collect that data from Websites that are offering those services (be they paid or free). You can use the function WebRequest() to obtain data from the web, but you will have to learn about HTTP, and depending on the API the website provides, you may also need to learn REST, JSON or XML or even standard HTML. These web protocols are however beyond the scope of this forum, so for more information you will have to search the Internet. Here are some links to get you started:
- https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
- https://www.w3.org/Protocols/
- http://www.json.org/
- http://www.w3schools.com/json/
- http://www.w3schools.com/xml/
- http://www.w3schools.com/html/
Please note, that collecting and parsing Web data via an API, is not something for a beginner or newbie coder. It requires at least an intermediate level of coding knowledge and good understanding about web protocols.
I also suggest reading the following threads on here:
EDIT: There are also relevant entries in the Codebase that will be of interest to you (had you done a search):
- Retrieve high impact events from ForexFactory.com and display them in your indicator or Expert Advisor
- FFC - Forex Factory Calendar
NB! However, please note that WebRequest() only works in EA's and Scripts but not in Indicators.
You will have to collect that data from Websites that are offering those services (be they paid or free). You can use the function WebRequest()to obtain data from the web, but you will have to learn about HTTP, and depending on the API the website provides, you may also need to learn REST, JSON or XML or even standard HTML. These web protocols are however beyond the scope of this forum, so for more information you will have to search the Internet. Here are some links to get you started:
- https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
- https://www.w3.org/Protocols/
- http://www.json.org/
- http://www.w3schools.com/json/
- http://www.w3schools.com/xml/
- http://www.w3schools.com/html/
Please note,that collecting and parsing Web data via an API, is not something for a beginner or newbie coder. It requires at leastan intermediate level of coding knowledge and good understanding aboutweb protocols.
I also suggest reading the following threads on here:
EDIT: There are also relevant entries in the Codebase that will be of interest to you (had you done a search):
- Retrieve high impact events from ForexFactory.com and display them in your indicator or Expert Advisor
- FFC - Forex Factory Calendar
NB! However, please note that WebRequest() only works in EA's and Scripts but not in Indicators.
Thank you for your reply. In the course of my search for a solution, I stumbled upon the indicator ffCal_net.mq4. I ran the program and it works fine. However, it does not output "Actual" data, but only "Forecast", "Previous", "Impact" and so on. I was not surprised because I went through the code and realized that "Actual" data was not included in the code. I tried to code the actual data to the best of my knowledge but I think I am still missing something as only the word "Actual" without data is displayed. Below is the output and some codes. Any idea how I may go around this please? Thank you in advance.
Thank you for your reply. In the course of my search for a solution, I stumbled upon the indicator ffCal_net.mq4. I ran the program and it works fine. However, it does not output "Actual" data, but only "Forecast", "Previous", "Impact" and so on. I was not surprised because I went through the code and realized that "Actual" data was not included in the code. I tried to code the actual data to the best of my knowledge but I think I am still missing something as only the word "Actual" without data is displayed. Below is the output and some codes. Any idea how I may go around this please? Thank you in advance.
Sorry! Although I have extensive experience with processing Web data, I have never used ForexFactory's data feed myself to be able to answer that. To be able to do it, I would have to research it.
Since, I am sure that you don't want to actually hire me to do that, lets hope someone else here does have first hand knowledge about their data feed and will be able to help you.
If however, no one answers, and you are seriously needing this; then consider submitting a job request in the Freelance section. You will then be able to choose from the users that apply.
EDIT: PS! I just took a quick look at ForexFactory's XML feed and can now say that there no "<actual>" element in it. You cannot just invent things that are not there in the first place! Just because "Actual" data is available on the web page, does not mean it is included in their XML data feed. Like a said before, this type of thing is not for beginners. You have to know what you are doing.
Sorry! Although I have extensive experience with processing Web data, I have never used ForexFactory's data feed myself to be able to answer that. To be able to do it, I would have to research it.
Since, I am sure that you don't want to actually hire me to do that, lets hope someone else here does have first hand knowledge about their data feed and will be able to help you.
If however, no one answers, and you are seriously needing this; then consider submitting a job request in the Freelance section. You will then be able to choose from the users that apply.
EDIT: PS! I just took a quick look at ForexFactory's XML feed and can now say that there no "<actual>" element in it. You cannot just invent things that are not there in the first place! Just because "Actual" data is available on the web page, does not mean it is included in their XML data feed. Like a said before, this type of thing is not for beginners. You have to know what you are doing.
Sorry to bug you guys once again. Here are some of the GrabWed codes. It
is actually not edit-friendly as unfriendly variables have been used to
"Grab" previous and forecast data among others, but not actual data.
The idea is to "Grab" actual data as well when it becomes available.
Sorry but I am only a litle good with visual basic, Meta quote, SQL and
languages, but not XML and the like, as I am not vast in computer
programming, as you have rightly said above (especially when it has to
do with web-based application. Particularly I cannot find my way around with the use of Buffers, iResult and so on. However, I could find my way around if
given some hints. Thank you in advance. Moreover, how much do you charge to get the "actual data working fine"?
Sorry to bug you guys once again. Here are some of the GrabWed codes. Itis actually not edit-friendly as unfriendly variables have been used to"Grab" previous and forecast data among others, but not actual data.The idea is to "Grab" actual data as well when it becomes available.Sorry but I am only a litle good with visual basic, Meta quote, SQL andlanguages, but not XML and the like, as I am not vast in computerprogramming, as you have rightly said above (especially when it has todo with web-based application. Particularly I cannot find my way around with the use of Buffers, iResult and so on. However, I could find my way around ifgiven some hints. Thank you in advance. Moreover, how much do you charge to get the "actual data working fine"?
@macpee. As I already stated, there is NO "actual" data in the XML feed. It does not matter if you use WebRequest or GrabWeb, if there is no such data in the feed, then there is nothing you can do about it.
You will have to find another source for the data or you will have to scrape FF's Calendar webpage instead, which will be even more difficult for you. You currently do not have the skills or knowledge to be able to do this, so first take some time to first learn the web protocols I have referenced and gain more experience with MQL.
According the forum rules, I am not allowed to mention my fees or offer my services here. You will have to go to the Freelance section, submit a job request and then find out from each applicant, how much they will charge you for the job.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use