Friday close and weekend gaps in an EA, the simple rules I added
my EA used to keep running into the weekend, and I was relying on luck that nothing would happen. A gap on Monday that took a stop out at a bad price convinced me to do something about it.
The rule I added is a Friday cutoff. After a set time on Friday, the EA stops opening new trades. Then, before the market closes, it closes whatever is still open. The time is set in GMT, using the offset calculation so it adjusts to the broker's server time.
There are a few details. Spreads widen as the market closes, so closing too late gets a bad price. I pick a time well before that. And if there's a trade that's in strong profit, I still close it, because I don't want exceptions. I also block pending orders from being placed after the cutoff, since they could trigger on the Sunday open.
It occasionally means I miss a late Friday move, but I've decided that's a fair price. The peace of mind of knowing nothing is open over the weekend is worth it.
Friday close and weekend gaps in an EA, the simple rules I added
Re: Friday close and weekend gaps in an EA, the simple rules I added
Closing a trade in strong profit before the weekend was hard for me to accept too, but I agree. The gap risk does not care whether the trade is winning. A strong position on Friday can open on Monday well beyond the stop. For a scalping EA the edge is intraday anyway, so holding over the weekend is taking a different kind of risk the strategy was not designed for. The GMT offset part is important as well, because a cutoff set in server time drifts when clocks change.
It’s Fairman 
Re: Friday close and weekend gaps in an EA, the simple rules I added
Something I would add is to also handle the Monday open. Even if the EA is flat over the weekend, the first hour on Monday can have wide spreads and gaps from the weekend news. I have the EA wait for a set time after the open before it can trade, until spreads settle. That avoids opening a trade into a gap fill that is still moving. It is the other half of the weekend rule. Between the Friday cutoff and the Monday delay, the EA only trades in the hours it was actually tested on, which is the whole point.
It’s Fairman 
-
FXS Prop Desk
- Posts: 1009
- Joined: Wed Oct 07, 2026 9:52 am
Re: Friday close and weekend gaps in an EA, the simple rules I added
A Friday cutoff and a weekend close rule are simple protections that every EA should have. Gaps on Monday can be large, especially after political or economic news during the weekend.
One detail: some brokers have shorter Friday sessions on certain pairs, and spreads widen in the last hour. Setting the cutoff a bit earlier, for example 20:00 Prague time, avoids trading during that thin period.
One detail: some brokers have shorter Friday sessions on certain pairs, and spreads widen in the last hour. Setting the cutoff a bit earlier, for example 20:00 Prague time, avoids trading during that thin period.
FXS Official Team | The Idea Lab & Strategy
-
Shadow Trader
- Posts: 2154
- Joined: Wed Sep 09, 2026 5:19 pm
Re: Friday close and weekend gaps in an EA, the simple rules I added
The cutoff also needs a holiday calendar, not just a Friday rule. Early closes around Christmas and New Year, and thin sessions like the Friday after US Thanksgiving, can go quiet and wide hours before a normal Friday would.
Daylight saving is the other trap, and the next one is close. Europe moves its clocks back on October 25 this year and the US on November 1, so for one week London and New York sit an hour closer together, and a cutoff built from a fixed offset is an hour off against one of them.
Reading session times from the broker's symbol settings is safer than hardcoding them. In MQL that is SymbolInfoSessionTrade, which returns the trading hours per weekday that the broker actually publishes.
For pending orders, deleting them at the cutoff is cleaner than only blocking new ones. An old limit left on the book from Thursday can still fill straight into a Sunday gap.
Does your EA treat a holiday Friday differently, or does it use the same fixed cutoff every week? Most of the ugly gap fills seem to come from those odd weeks.
Daylight saving is the other trap, and the next one is close. Europe moves its clocks back on October 25 this year and the US on November 1, so for one week London and New York sit an hour closer together, and a cutoff built from a fixed offset is an hour off against one of them.
Reading session times from the broker's symbol settings is safer than hardcoding them. In MQL that is SymbolInfoSessionTrade, which returns the trading hours per weekday that the broker actually publishes.
For pending orders, deleting them at the cutoff is cleaner than only blocking new ones. An old limit left on the book from Thursday can still fill straight into a Sunday gap.
Does your EA treat a holiday Friday differently, or does it use the same fixed cutoff every week? Most of the ugly gap fills seem to come from those odd weeks.
-
Shadow Trader
- Posts: 2154
- Joined: Wed Sep 09, 2026 5:19 pm
Re: Friday close and weekend gaps in an EA, the simple rules I added
The weak point in a Friday close rule is the close itself failing. Requotes, a busy trade context, or a VPS that restarted on Friday afternoon can all leave a position open past the cutoff without anyone seeing an error.
A retry loop covers most of it. Trying the close every 10 seconds for five minutes, then sending a push alert if anything is still open, turns a silent failure into a phone notification while there is still time to act.
A broker side stop on every position is the backstop for when the EA itself is down. It does nothing about a gap, but it caps a trade that was meant to be closed and was not.
For the Monday side, a spread gate tends to work better than a fixed delay. Say the normal EURUSD spread is 0.2 pip; the EA waits until it has stayed under 0.5 for five straight minutes, which clears quickly on a quiet Monday and can take most of the first hour after a weekend gap.
Does the EA record the spread at each Friday close? That number shows quickly whether the cutoff is early enough.
A retry loop covers most of it. Trying the close every 10 seconds for five minutes, then sending a push alert if anything is still open, turns a silent failure into a phone notification while there is still time to act.
A broker side stop on every position is the backstop for when the EA itself is down. It does nothing about a gap, but it caps a trade that was meant to be closed and was not.
For the Monday side, a spread gate tends to work better than a fixed delay. Say the normal EURUSD spread is 0.2 pip; the EA waits until it has stayed under 0.5 for five straight minutes, which clears quickly on a quiet Monday and can take most of the first hour after a weekend gap.
Does the EA record the spread at each Friday close? That number shows quickly whether the cutoff is early enough.