Retrieve High Impact Events from Forex Factory and Display in MT4/MT5
Info
The Retrieve High Impact Events from Forex Factory and Display in MT4/MT5 is a Expert Advisor for MetaTrader 4 that as i'm developing an expert advisor for crude oil and brent, i need to obtain the exact date and time of the 'crude oil inventory' report from forexfactory. com.
Usage
This tool is typically used for automated trading on major forex pairs and gold.
Platform
This Expert Advisor works exclusively on MetaTrader 4 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL4/Experts folder via File ? Open Data Folder in MetaTrader 4.
How to Install and Use Retrieve High Impact Events from Forex Factory and Display in MT4/MT5
1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.
2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.
3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.
4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.
Frequently Asked Questions
Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.
Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.
Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.
What this tool does
As I'm developing an expert advisor for crude oil and Brent, I need to obtain the exact date and time of the 'crude oil inventory' report from forexfactory.
Typical Use Case
This Expert Advisor excels in automated trading and technical analysis on MetaTrader 4.
Compatible Platform & Setup
This Expert Advisor works on MetaTrader 4. Place the file in the MQL4/Experts folder and restart the terminal.
Description & Settings
Related: heads or tails trading strategy: a high-risk approach - another powerful expert for MetaTrader 4 traders.
As I'm developing an expert advisor for crude oil and Brent, I need to obtain the exact date and time of the 'crude oil inventory' report from forexfactory.com. This report is usually released on Wednesdays at 10:30 AM Eastern, but holidays can alter the release date.Also recommended: ms lea - expert advisor based on market structure high/low - similar expert with strong performance on MetaTrader 4.
To manage this data, define a structure in your code to store the events. Place this at the top of your code, declaring 'dailyevents' as a global variable with a maximum number of stored events defined by 'maxdailyevents'.
Next, retrieve the HTML code from forexfactory.com and parse it. Build the URL for the web request by setting the 'day' parameter to today's date. Send the request, check the error code, and convert the returned character array to a string for easier parsing.
Convert the character array 'result' to a string for better parsing. Use the 'stringfind' function to locate HTML elements, ensuring the returned HTML is for today's date. Cut anything before the relevant HTML tag. The 'gethtmlelement' function is used to parse the HTML and return the value between specified tags.
Now, start parsing each table row to extract event time, currency, impact, and title. Perform this action for each row until the end of the calendar or 'maxdailyevents' is reached.
Add the extracted data to the 'dailyevents' structure. Once all table rows are parsed, display the events on the chart. If an event is in the future, display a vertical line; if in the past, omit the line.
Notify the user of upcoming events within 5 minutes of the current time and remove the vertical line. Add code to the 'start()' function for this notification. Obtain daily events by adding a line in the 'oninit()' function.
You can modify the code to display all events for a currency pair, add input parameters to specify impact (high, medium, low), and include a check for midnight to update the daily events list.
You may also like: Liquidex HFT EA: A High-Frequency Trading Expert Advisor - excellent alternative for expert users on MetaTrader 4.
Source Code
#property copyright "robotfx"
#property link "https://robotfx.org"
#property version "1.00"
#property strict
struct events
{
string time;
string title;
string currency;
bool displayed;
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.