Before you bin a losing EA, split its trades by leg

2 December 2026, 18:04
Dakshal Kailash Raijada
0
2

When a backtest loses, the usual move is to change the inputs and run it again. Before doing that, split the trades into their parts and look at each one on its own. I learned this on a small EUR/USD system, and the same check turned up a trading-hours trap that can affect any EA with a fixed evening exit.

The system

The idea came from published research on the FX session cycle: a currency tends to fall a little during its own country's working hours. So the EA sold EUR/USD during European hours, switched to a buy around midday, and closed everything at 21:00 UTC. That is two trades every weekday, about 520 a year.

I optimized only the session start and switch times and the emergency stop. That gave 27 combinations on 2019 to 2022 tick data, and all 27 lost money. The profit factors (gross profit divided by gross loss) ran from 0.87 to 0.97, with about 1,558 trades in each test.

Split by leg

Before the optimization I had written down that I would split the result by leg. That matters, because a split you think of after a loss is easy to turn into a search for whatever looks good. On the best combination:

- The European-hours sell made +$1,447.59 over 780 trades. That is about 0.75 pips a trade after the spread and before commission, and it rose in an almost straight line for three years.
- The US-hours buy lost $2,971.92 over 778 trades. Most likely the strong dollar from 2021 on worked against it.

So the losing total hid a real effect. One half did what the research said, and the other half buried it.

The arithmetic check

The obvious next step was a sell-only version. I didn't need to run it. Commission at $3.50 a side per lot comes to about 0.7 pips a round trip on EUR/USD. 0.75 pips minus 0.7 leaves about 0.05 pips a trade. No change to the hours or the stop turns that into a profit factor worth trading, and my own minimum is 1.3.

This check costs nothing and works on any EA. Take the average profit per trade before commission, turn it into pips, and put it next to what one round trip costs you in commission. If the two numbers are close, more optimization won't save the system. A real effect that is smaller than your costs is still a losing trade.

Getting the split in MT5

The tester report doesn't split trades by leg for you. The simple way is to give each leg its own magic number or order comment. Then export the Deals table and add up the profit for each one. If your rules depend on the time of day or the weekday, split by hour and by weekday too.

The Friday 21:00 trap

Going through the Deals table showed one more thing. In US summer time the FX week ends at exactly 21:00 UTC on Friday. No tick arrives at or after 21:00, so an exit set for 21:00 never fires on those Fridays. The trade stays open over the weekend until Monday.

82 of the 1,558 trades were held over a weekend this way. By chance they made +$1,875 in price, so the system closed on the same day would have been about $1,700 worse than the report showed. Here that only made the verdict clearer. On another system the same thing could make a losing strategy look like a winner.

To check your own EA, sort the Deals table by close time and look for positions closed on a Monday when your rules say they close the same day. If you find them, move the exit earlier. I now keep every same-day exit at 20:55 UTC or earlier.

What I check now

1. Split a losing result by leg, side or session before changing any input, and decide on the split before the test.
2. Compare the profit per trade in pips with the commission per trade in pips.
3. Check that every exit in the Deals table happened when the rules say it should.

These are backtest results, not live trades.