MetaTrader4
Unlock Your Trading Potential with the Fundamental Trader EA for MetaTrader 4
Description:
The Fundamental Trader EA is designed to automate trading decisions based on news events. Unlike typical trading systems, this EA cannot be back-tested using historical data. Instead, it operates in real-time, waiting for the next news event to make informed trading decisions based on the actual versus forecasted data or actual versus previous data.
After downloading the economic calendar, the EA identifies the next scheduled news event from the DailyFX calendar. Once the news is released, it triggers a trading decision. This EA can be applied to any chart and time frame since it utilizes the chart solely for order execution. It supports all countries listed on the DailyFX calendar, as detailed below.
NOTE:
To get this EA up and running, you must follow the setup instructions for the main files from the following site:
https://www.mql5.com/en/articles/1502
This EA is built on the code from an indicator specified in the link above. You MUST first follow the instructions in the link and set up the following files:
getright_setup.zip
Time.mq4
Time.mqh
Ensure you change the default "get right" download directory to where the calendar will be downloaded; otherwise, this EA won't function properly.
Take your time to read that article carefully and follow every instruction. It provides a thorough explanation of what those files do and how they contribute to displaying news events in your chart window.
It's a good idea to set up that indicator first and display the news on your chart; this way, the EA will work without any issues.
The indicator source code has been modified to create an EA that trades the news instead of just displaying it.
Once you've set up the files from the link provided, you can download this EA along with "str2double.dll". This file should be placed in the root directory, e.g. C:\Program Files\Interbank FX Trader 4\
Trading Logic:
The trading logic operates on two types of events when trading news:
1st: Actual economic data compared to forecasted economic data.
2nd: Actual economic data compared to previous economic data.
The difference in economic data can influence currency price direction. A larger percentage difference between economic data increases the likelihood of a market reaction in a specific direction.
For more information on Fundamental Trading, visit www.pfxglobal.com.
When there's a significant percentage difference between economic data, the EA executes trades with larger lot sizes.
When the percentage difference is minimal, the EA trades with smaller lot sizes.
These lot sizes are defined when applying the EA to the chart with variables: lot1, lot2, lot3, lot4, lot5, lot6... up to lot18.
The EA will select the appropriate lot size based on the percentage difference between economic data.
Risk/Reward Ratio:
The Fundamental Trader EA is configured with a 1:3 risk/reward ratio, where the default values are risk=20 and reward=3.
Risk represents the PIP StopLoss values, and reward is a multiplier—when risking 20 PIPs, the EA aims for a 60 PIP gain.
These values can be adjusted when applying the EA to the chart.
Wait Time for News Event Release:
News data is not always released at the exact scheduled time; therefore, you need to set a wait time for the EA to monitor the news events.
The following code snippet determines the wait time for the news release. Once the wait time has lapsed, the EA moves on to the next scheduled news event.
xTime is a variable that can be modified upon first applying the EA to a chart, with a default setting of 27 minutes.
if(Date>(TimeCurrent()-(xTime*60)))
Wait Time for Order Closure:
You can also configure a wait time for the EA to hold an open order before closing it.
For instance, after a news event is released, and a position is executed, you might wait 30 minutes to close the order, whether it results in profit or loss. This method is recommended by MQL4 user "ebenv".
There are three variables that control this functionality:
MagicNumber | A number used to track opened orders.
enable_close_time | Set to true to enable the EA to monitor the time elapsed since the order was executed.
wait_time | Time to wait before closing the order.
Supported Countries for Fundamental Trader:
The Fundamental Trader EA trades every currency supported on dailyfx.com/calendar.
Below is a code snippet that specifies which currencies to trade based on the country where the news event is released. Supported currencies include: EUR, USD, JPY, GBP, CHF, AUD, CAD, NZD.
if(stCurrency=="EUR") { ordercurrency="EURUSD"; } // trading eurusd
if(stCurrency=="USD") { ordercurrency="EURUSD"; } // trading eurusd
if(stCurrency=="JPY") { ordercurrency="USDJPY"; } // trading usdjpy
if(stCurrency=="GBP") { ordercurrency="GBPUSD"; } // trading usdgbp
if(stCurrency=="CHF") { ordercurrency="USDCHF"; } // trading usdchf
if(stCurrency=="AUD") { ordercurrency="AUDUSD"; } // trading audusd
if(stCurrency=="CAD") { ordercurrency="USDCAD"; } // trading usdcad
if(stCurrency=="NZD") { ordercurrency="NZDUSD"; } // trading nzdusd
Trading Decision:
The following code snippet describes how the EA makes trading decisions while waiting for actual economic data when forecast data is available.
If forecast data is not available, the EA uses previous data to guide its trades.
The following code snippet illustrates how trades are executed based on forecast and actual data, utilizing the same algorithm when comparing previous and actual economic data.
if(StringToDouble(stActual)>StringToDouble(stForecast)) { Aert("Stronger(actual vs forecast): " + stCurrency + " " + "Time: " + stTime); int total=OrdersTotal(); for(int cnt=0; cnt
2008.10.15