This Expert Advisor (EA), named NEWS
MT4 EA, is designed to trade based on certain market conditions, such as volume, volatility, spread, and trend direction, and uses specific trading hours.
The initial idea for this EA was to trade in news events when the volume is high and new trends start to form due to significant news events.
With the tests, we started to see that it could also be used in other market conditions, depending on our setups.
The main idea is to use candle volume to track daily trends or trend-changing events. For this, the EA uses candles to determine the trend, the ATR indicator to determine the volatility of the asset, and the volume to determine the potential for a trend.
Here’s a breakdown of its main logic, functionality, and setup.
Key Logic and Functionalities
- Expiry and License Check:
- The EA checks if it has expired by comparing the current time to a pre-defined expiry date (
ExpiryDate
). If expired, it stops functioning. - It also includes code for verifying specific brokers or accounts (currently commented out).
- The EA checks if it has expired by comparing the current time to a pre-defined expiry date (
- Trading Conditions:
- The EA operates only within specified hours (
StartHour
toEndHour
), set by the extern variablesStartHour
,StartMinute
,EndHour
, andEndMinute
. - It uses a Spread Filter (
CheckSpread
) to ensure that the current spread does not exceedMaxSpread
. - The Volume Filter (
CheckVolume
) ensures that the candle volume meets a minimum threshold (MinCandleVolume
) before allowing trades. - The Volatility Filter (
CheckVolatility
) uses the ATR indicator to check for sufficient market volatility, with the threshold controlled byATRThreshold
. - An H4 Trend Filter (
CheckH4Trend
) checks if the H4 candle’s close is higher than its open, signaling a bullish trend for trades in that direction.
- The EA operates only within specified hours (
- Profit and Loss Limits:
- Daily and weekly profit/loss limits are monitored with the
CheckProfitLossLimit
function. If either the daily or weekly profit exceeds a specified percentage of the account balance (DailyProfitLimit
orWeeklyProfitLimit
), the EA halts trading.
- Daily and weekly profit/loss limits are monitored with the
- Trading Strategy:
- Trades are opened based on recent candle data: if both the previous and current candles are bullish (close > open), it initiates a BUY; if both are bearish (close < open), it initiates a SELL.
- Before placing a trade, it checks all configured filters, as well as open trades (using
CheckForOpenTrades
) to ensure no other trade for the symbol with the sameMagicNumber
is active.
- Trailing Stop and Break-Even Logic:
- If enabled (
UseTrailingStop
), the EA applies a trailing stop based on ATR, using two multipliers (initialTrailingStopMultiplier
andexpandedTrailingStopMultiplier
) for tighter and wider trailing stops depending on market conditions. - Break-even functionality is implemented with
BreakEvenPoints
(distance in points to move stop-loss to breakeven) andBreakEvenBuffer
(buffer beyond break-even for additional safety).
- If enabled (
- Chart Information Display:
- The EA creates and updates information on the chart, displaying key metrics such as:
- Magic Number
- Open Buy/Sell Orders
- Net Profit/Loss
- Current Spread
- Profit Target
- These details help the user monitor the EA’s trading state.
- The EA creates and updates information on the chart, displaying key metrics such as:
Key Extern Variables (Setup)
- Trade Management:
MagicNumber
: Unique identifier for this EA’s trades.Lots
: Lot size for each trade.Slippage
: Allowed slippage for trades.StopLoss
andTakeProfit
: In points, these set the SL and TP for trades if enabled.
- Filters and Conditions:
- Volume and Volatility:
MinCandleVolume
,ATRThreshold
,UseCandleVolume
,UseVolatilityFilter
. - Trend and Spread:
UseH4TrendFilter
to enable/disable the H4 trend filter,MaxSpread
to set a maximum spread filter.
- Volume and Volatility:
- Profit and Loss Limits:
DailyProfitLimit
andWeeklyProfitLimit
: Set as percentages of account balance.UseProfitLossLimit
: Boolean to enable or disable profit/loss limits.
- Trading Time Window:
StartHour
,StartMinute
,EndHour
,EndMinute
: Define the hours during which the EA can operate.
- Trailing Stop and Break-Even:
UseTrailingStop
,initialTrailingStopMultiplier
,expandedTrailingStopMultiplier
,BreakEvenPoints
,BreakEvenBuffer
: Parameters controlling the trailing stop and break-even levels.
How have we been using the News MT4 EA?
This EA has been tested for a couple of months so far, with interesting results. In order to get the best results, it is important to use the Minimum candle volume to trigger trades function with the adapted value for each asset so that it opens trades only in moments when the asset shows some volatility.
Some assets perform well only in determined periods of the day; for that, you will use Minimum candle volume to trigger trades and the StartHour and EndHour functions to enable and disable trading in hours when the trend is not usually strong.
One important thing is the trailing stop functions:
extern bool UseTrailingStop = false;
extern double initialTrailingStopMultiplier = 1.2; // Initial tighter trailing stop (ATR * 1)
extern double expandedTrailingStopMultiplier = 2.5; // Expanded trailing stop (ATR * 2)
Even though we know that, in theory, the trailing stop is attractive, our tests showed that in many cases, it closes too soon the trades, so, lately, we don’t use it, but again, you are free to create your setup, and who knows you show us, that we are wrong, about trailing stop.
We are testing the News MT4 EA using two different logics:
1 – Small Stop Loss with a Large Take Profit
In Forex Pairs, we use a Stop Loss of 100 or 200 points (10 to 20 pips) and a Take Profit of 500 to 1000 points (50 to 100 pips).
This 1:5 up to 1:10 ratio means that most of the trades are losses, but the EA never loses a large amount of funds. It can have days when it loses all the trades (especially if your candle volume is not adequate), but when it makes a profitable trade, it can recover all in just one trade.
One of the pairs we saw good results was GBPUSD since it is quite volatile and can go in a trend for days.
One of the problems is the mental aspect of using this setup. We may see four, five, or six trades in a row to be Stopped and lose the patience to wait for one simple profitable trade that will reverse the lost value by hitting the Take Profit.
2 – Big Stop Loss with a Medium / Large Take Profit
This is maybe the most logical way to use the News MT4 EA because since it searches for a Trend, it is perhaps better to have a Stop Loss of around 500 to 1000 points (50 to 100 pips) and a Take Profit of 500 to 1000 points (50 to 100 pips).
In this case, we have a ratio of 1:1, meaning that to be profitable, we need to have more than 50% trades to hit the Take Profit.
One very helpful tool for this setup is the End-of-Day Order Manager. It closes the profitable orders at the end of the day and waits for the new D1 and H4 candles to form for the next day.
Summary
The NEWS MT4 EA is a news-based trading algorithm with safeguards to prevent high-spread trading, ensure volatility and volume are adequate, and align trades with the H4 trend.
Its use of stop-loss, take-profit, and trailing stop mechanisms enables risk management, and it has daily and weekly profit/loss limits.
This EA also restricts trading hours and tracks profit across trades to display real-time trading data directly on the chart.
Other Posts For You:
What is Auto Trading, and How Does It Work?
Break Even Function in Metatrader
Download the News MT4 EA
The News MT4 EA is in the test stage; please don’t use it in a real account until you have tested it in a demo account.
You need to adapt the hours of the News MT4 EA to your broker time zone.
When we wrote this post, we used a broker in the UTC+3 time zone (summertime).
You can download the End-of-Day Order Manager tool on this link: Dropbox link to MT4 EA
Don’t have an MT4 Demo account to test the tool?
You can test it on any broker that offers MT4 demo accounts.
4XC – MT4 Demo Account and 100% deposit bónus with the promo link: PROMO LINK
AVA Trade – MT4 Demo Account: LINK FOR DEMO
ROBO FOREX: MT4 Demo Account: LINK FOR DEMO
If you try the News MT4 EA, please don’t forget to tell us about the results, suggestions, and ideas to improve this EA.
Use the form below to leave messages.
Check also our other EAs and Tools.
Try something like 1000 points to both Stop Loss and Take Profit on forex pairs, and 2000 points in XAG, XAU and indices.
Hi Rui,
OK, I’ll change the Stop Loss to a bigger one, and the Take Profit too.
At night, all profitable orders are closed. I already use the tool available on the website.
Hi Alberto,
Try to use larger Stop Loss, and larger Take Profit, and at the end of day/night, close all the profitable open trades. I am asking this, because in a new EA that we are working, we will use it, together with a tool that does this (the tool is already available on this site). I believe that with a larger SL and this tool, the EA may give better results.
Hello Rui,
Results from the last two weeks:
EA NEWS_V21
Week from October 28th to November 1st
Results:
EURUSD (Original Setup): +0.2$
GBPUSD (Original Setup): -18.4$
USDCAD (Original Setup): -18.25$
XAGUSD (Original Setup): -482$ (stopped EA on October 30th and started trading with EA XAG-V6)
XAUUSD (Original Setup): +14.94$ (stopped EA on October 30th and started trading with EA XAG-V6)
Total for the week: -503.9$
EA worked 24 hours non-stop
EA NEWS_21
Week from November 4th to 8th
Results:
EURUSD (Original Setup): -67.3$
GBPUSD (Original Setup): -35$
USDCAD (Original Setup): – 21.18$
Total for the week: – 123.48$
EA worked 24 hours non-stop
Regards
Alberto
Hi Alberto,
Thanks for sharing your results. Check both XAU and XAG entry lots and TP / SL. Since both are very volatile, maybe we need to increase either SL or TP or simply stop using them with this bot. Try a couple more weeks, and if the results don’t improve, then this EA is probably not suitable for using those assets.
The EA XAG_V6 is getting excellent results, but it works very differently from this one.
Also, try to limit the trading hours to those two assets from 7h00 to 18h00 server time.
The idea is to test a couple of weeks for different setups and try to find the best solutions.
Thanks for testing and sharing your results.
Rui
Results for the week of October 21-25
EURUSD +7.9$
GBPUSD – 9.3$ (on Friday it was -17.2$)
USDCAD +25.29$
XAGUSD and XAUUSD were not recorded separately. The losses were -785$
There is an important issue. The values involved in the first 3 indices vary between 0 and 10$ and in XAUUSD and XAGUSD between 0 and 200$