Most of an Expert Advisor's (EA's) trades happen in ordinary conditions: the market is open, liquidity is normal and nothing important is being announced. A backtest models those trades reasonably well.
A small share of trades live through something else. They are held over a weekend, open across the daily rollover, or catch a scheduled news release. These trades are rare, so they barely move the averages in a backtest report. But they are often where the worst single days come from, and the worst days are what end accounts and evaluations.
This guide covers three kinds of event risk that EA backtests usually under-represent, how each one shows up in the MT5 Strategy Tester, and a practical way to find and stress-test them in your own trade list.
One point up front: event risk lives in the tails, so averages hide it. A strategy can have a healthy average trade and still take most of its largest losses from a handful of weekend or news trades. Testing for these events tells you how exposed a strategy is. It does not remove the risk, and it does not predict when the next event will happen.
Why averages hide event risk
Suppose, as a hypothetical example, that 4% of an EA's trades are held over a weekend. If those trades behave a little worse than the rest, the report's profit factor and average trade barely change. The question that matters is different: what share of the largest losses came from that 4%?
If the answer is "most of them", the strategy's real risk is concentrated in a small set of situations that the backtest may also model optimistically. That is worth knowing before any money or evaluation is involved.
So the method throughout this guide is the same: tag each trade by the events it lived through, then look at each group separately.
Weekend gaps
What happens
The spot FX market closes on Friday evening and reopens on Sunday evening, depending on your broker's server time. Many CFD markets close for longer, and some close for holidays mid-week. News does not stop while the market is shut. When it reopens, the first price can be some distance from Friday's last price. That jump is the gap.
A stop-loss is an instruction to close at the next available price once the stop level is reached. If the market opens beyond your stop, the next available price is the opening price, not your stop. The loss can be larger than the stop distance the EA was designed around.
What the backtest may miss
- How gap fills are modelled. Check how your tester fills stops across a gap rather than assuming. Find trades that closed in the first minutes of the week and compare each fill price with the stop level. If every one fills exactly at the stop even when the week opened beyond it, the test is more optimistic than the market.
- Whether the gaps are in the data at all. The size of a weekend gap depends on the history you test on. Data from a different source or time zone from your broker can show different Friday closes and Monday opens. See MT5 backtest data quality for how to check history for gaps and spikes.
- Sunday bars. On data whose day boundary sits at midnight GMT, the short Sunday evening session forms its own small daily bar. Brokers whose server clock is set so that the week opens at midnight have no such bar. Daily-bar indicators, such as a 20-day average or yesterday's high, can calculate differently on the two, so the same EA can trade differently on two data sets that cover the same dates.
- Holiday sessions. Thin markets around major holidays can produce gaps and wide spreads mid-week. A backtest on clean, idealised data can smooth them away.
How to test it
- Tag weekend trades. Mark every trade that was open when the market closed for the weekend.
- Compare the groups. Average result, worst loss, and their share of the ten largest losses.
- Measure your own gap history. For the symbol you trade, compute the gap between each Friday close and the following open in your data. Look at the largest, not the average.
- Apply an adverse gap. For each weekend-held trade, re-price it as if the week had opened against it by a large historical gap, and see whether any single trade, or any day, then exceeds what the strategy or account can absorb.
- Run a "flat by Friday" version. Add a rule that closes all positions before the weekend and re-test. If the strategy's results depend heavily on weekend holding, that is a risk decision to make deliberately, not something to discover live.
If the account has a daily loss limit, a gap at the weekly open lands in the first trading day of the week, all at once. Sizing for that is covered in EA position sizing for daily loss limits. Some prop-firm accounts also restrict holding positions over the weekend; read your own account's rules.
Swaps and the daily rollover
What happens
A position held past the daily rollover is charged or credited swap. Swap reflects the interest-rate difference between the two currencies in a pair, or the financing cost of a CFD, plus any broker mark-up. It can be negative in both directions on some symbols.
Three details matter for an EA:
- The triple-swap day. One night a week, swap is charged at three times the normal rate to cover the weekend. For spot FX this is commonly Wednesday night, because of how settlement dates fall; for some indices, metals or other CFDs it can be a different day. Your symbol's specification in MT5 shows which day applies.
- Swap rates change. They follow interest rates, and interest rates have moved a long way over the last decade or two. The tester applies the symbol's current swap settings across the whole history, so a ten-year test uses today's rates for every year. For a strategy that holds for days or weeks, that can be a meaningful distortion.
- Swap-free accounts. Some accounts replace swap with a fixed fee or a different charge after a set number of days. A backtest run with ordinary swap settings won't reflect that.
The rollover window itself
Around the daily rollover, commonly near 17:00 New York time, liquidity is thin for a short period and spreads can widen sharply. Two things follow:
- Stops can be hit by the spread, not the price. A sell position's stop is triggered by the ask. If the spread widens enough, the ask can touch the stop while the chart, which usually shows the bid, never comes near it.
- Entries at the rollover pay more. An EA that opens trades on the first bar of the new server day may be trading in the widest-spread minutes of the day.
The tester can only reproduce this if the tick history contains the real spreads. A test with a fixed spread, or with generated ticks using a low spread value, removes the rollover spike altogether. The general cost side of this, including how to stress-test spread and slippage, is covered in why an EA trades worse live than in its backtest.
How to test it
- Report swap separately. Total swap paid or received, as a share of gross profit. If swap is a large part of the result, the strategy is partly a financing trade, and its result depends on rates that will change.
- Re-test with different swap. On a custom symbol, where you set the swap values yourself, re-run the test with swap doubled, with swap set to zero, and with the sign reversed. A strategy whose result flips with plausible swap changes is fragile on that dimension.
- Count triple-swap nights. Check how many positions are open across the triple-swap rollover, and whether that charge, landing on one server day, matters for a daily limit.
- Check trades near the rollover. List trades opened or stopped out within a few minutes either side of the rollover, and check the spread recorded at those times.
News spikes
What happens
Around a major scheduled release, such as a central bank decision or a key employment or inflation figure, liquidity providers often pull back for a moment. Spreads widen, prices can jump several levels at once, and orders can fill well away from their requested price. The move itself can reverse within minutes, after stops on both sides have been triggered.
What the backtest may miss
- The tick data may be thin or incomplete. Tick history around big releases is where gaps and missing ticks are most common. A test can only reproduce the prices it has.
- Generated ticks guess the path. In the tester's faster modes, the price path inside each bar is generated from its open, high, low and close. On a news bar with a huge range, the tester has to guess whether the high or the low came first. If both the stop and the target sit inside that bar, the guess decides the trade. Test intrabar-sensitive strategies in "Every tick based on real ticks" where real tick data exists.
- Fills at the stop price. Backtests tend to fill stops at or near their level. In a fast release, real fills can be some distance beyond it.
- News filters that do nothing in testing. If the EA avoids news using an economic calendar, check that the filter actually receives event data inside the Strategy Tester. Built-in calendar functions are built for the live terminal, and a filter that silently gets no events in testing produces a backtest with no news filter at all. A common fix is to load an exported calendar file with the event times.
There is a subtler trap too. If you build a news filter by looking at which past releases hurt the strategy and then excluding those, you have used the test results to design the rule. That is a form of the bias covered in look-ahead bias in EA backtests. Decide the filter rule (which event types, how many minutes either side) before you look at the results.
How to test it
- Get a calendar. Export the history of high-impact events for the currencies you trade, with times converted to your broker's server time.
- Tag news trades. Mark trades opened, closed or held within a window around each event, for example 15 minutes either side.
- Compare the groups. As with weekend trades: average result, worst loss and share of the largest losses.
- Stress the news group only. Re-price news trades with a much wider spread and extra slippage on stops, and leave the rest alone. This shows the exposure without punishing ordinary trades for a risk they don't carry.
- Test the filter on and off. If you use a news filter, run with and without it, and confirm the trade count actually changes.
Some prop-firm accounts restrict trading around high-impact news, or treat profits from those windows differently. Read your own account's terms, and include those rules in your rule replay.
Tagging every trade by event
The steps above all start the same way. The function below takes an exported trade list and a list of event times and adds three flags to each trade. Adjust the rollover hour and the market-close detection to your broker's server clock.
import pandas as pd
def tag_events(trades, events, rollover_hour=0, news_window_min=15):
"""trades: DataFrame with 'open_time' and 'close_time' (server time).
events: sequence of high-impact event timestamps (server time).
Adds weekend, rollover-count and news flags to each trade."""
t = trades.copy()
win = pd.Timedelta(minutes=news_window_min)
ev = pd.Series(sorted(pd.to_datetime(events)))
def spans_weekend(o, c):
# True if a Saturday falls between open and close
days = pd.date_range(o.normalize(), c.normalize(), freq="D")
return any(d.dayofweek == 5 for d in days)
def rollovers(o, c):
shift = pd.Timedelta(hours=rollover_hour)
return ((c - shift).normalize() - (o - shift).normalize()).days
def near_news(o, c):
return bool(((ev >= o - win) & (ev <= c + win)).any())
t["weekend"] = [spans_weekend(o, c) for o, c in zip(t.open_time, t.close_time)]
t["rollovers"] = [rollovers(o, c) for o, c in zip(t.open_time, t.close_time)]
t["news"] = [near_news(o, c) for o, c in zip(t.open_time, t.close_time)]
return t
Then group by each flag and compare the trade count, the average result, the worst trade and how many of the ten largest losses fall in each group. The "rollovers" count is a simple calendar-day count. It includes weekend days, so treat it as an approximate measure of overnight exposure rather than an exact count of swap charges.
What a backtest assumes vs what can happen
| Event | What a backtest often assumes | What can happen live | What to test |
|---|---|---|---|
| Weekend gap | Stop fills near the stop level; clean Friday and Monday prices | The week opens beyond the stop and fills at the opening price | Tag weekend trades; apply large historical gaps; run a flat-by-Friday version |
| Swap | Today's swap rates across the whole history | Rates differ year to year; triple swap lands on one night | Report swap separately; re-test with changed swap on a custom symbol |
| Rollover | A fixed or average spread | A short, sharp spread spike that triggers stops | Check recorded spreads at rollover; list trades near it |
| News release | Smooth prices and fills at the requested level | Spread blow-outs, jumps through stops, rapid reversals | Tag news trades; stress them only; confirm the news filter works in the tester |
This table describes typical modelling assumptions, not the behaviour of any specific broker or account.
Common mistakes with event risk
- Judging event risk from averages. Look at where the largest losses came from.
- Assuming every stop fills at the stop. Gaps and releases are exactly when they don't.
- Ignoring the Sunday-bar difference. The same EA can trade differently on data with and without it.
- Using today's swap for a ten-year test without a sensitivity check.
- Testing with a fixed spread. It removes the rollover and news spikes entirely.
- Building a news filter from the backtest's worst days. Decide the rule first.
- Trusting a news filter you haven't seen work in the tester.
Event risk checklist
- Every trade tagged: held over a weekend, rollovers crossed, near high-impact news
- Each group compared on average result, worst trade and share of the largest losses
- Stop fills at the weekly open compared with stop levels
- Largest historical weekend gaps measured on your own data and applied to weekend-held trades
- Flat-by-Friday version tested
- Swap reported separately and re-tested with changed rates; triple-swap day confirmed
- Recorded spreads checked at the rollover; trades near it listed
- News trades stressed separately; news filter rule fixed before results were viewed
- News filter confirmed to receive event data in the tester
- Account rules on weekend holding and news trading read and included in the rule replay
Frequently asked questions
Does the MT5 Strategy Tester model weekend gaps?
It can only reproduce gaps that exist in the price history you test on, and the way stops are filled across them depends on the testing mode and data. Check it directly: compare fill prices with stop levels on trades that closed at the start of the week.
What is triple swap?
One night a week, swap is charged at three times the usual rate to cover the weekend. For spot FX it is commonly Wednesday night; other instruments can use a different day. The symbol specification in MT5 shows which day applies to each symbol.
Should my EA avoid trading around news?
That is a strategy design decision, and the answer depends on the strategy. What matters is knowing how exposed it is. Tag the trades near news, look at their share of the largest losses, and stress them separately before deciding.
Why did my stop fill well beyond its level?
Usually because the market moved through the stop without trading at that price: a gap at the open, a fast release or a spread spike at the rollover. A stop-loss closes at the next available price, which is not guaranteed to be the stop level.
If my backtest has no big weekend losses, am I safe?
No. The test only contains the weekends in its history, priced by the data you used. Larger gaps than any in your sample are possible, which is why it helps to stress weekend-held trades with gaps at least as large as the biggest you can find.
Want a second pair of eyes?
Start with our free Sample Stress-Test Report. It walks one anonymized, illustrative strategy through a full stress test, start to finish, so you can see what rigorous validation looks like before you test your own.
Read the Sample Stress-Test ReportWant your own backtest checked? The Strategy Audit + 60-minute call is a paid service at a launch price of £100, credited in full against our build and portfolio offers. You send an MT4/MT5 Strategy Tester report or trade-list CSV; what we can check depends on the files you supply, and walk-forward and parameter sweeps are not included because they need the strategy itself. It is analysis of strategy testing, not investment advice, and does not promise any trading or evaluation outcome. See the Strategy Audit
Disclaimers
CollosoTrading provides educational content and analytical services for retail and professional algorithmic traders. We do not provide regulated investment advice, financial advice, or personal recommendations. Trading derivatives, leveraged products, and CFDs carries a high level of risk and may result in losses exceeding deposits. Past performance, including any verified or unverified historical results referenced on this site, is not indicative of future results. Consult an independent regulated financial adviser before making investment decisions.
All figures are backtests or simulations unless marked LIVE. Hypothetical or backtested performance results have inherent limitations and may not reflect actual trading. No representation is made that any account will or is likely to achieve profits or losses similar to those shown. Individual results vary. Any figures in this article are hypothetical arithmetic for teaching purposes, not results from any strategy or account. We do not guarantee the outcome of any prop firm challenge.