My MT5 analyser splits losing trades into two kinds: the ones that were in profit first (an exit problem) and the ones that went wrong right away (an entry problem). A reader, @arhancanli, left a comment on an earlier post that took that split apart in two sentences:
With a stop of 1% and noisy bars, a random entry will often show a small positive MFE before it is stopped out, so "most losers were once in profit" can come out high even when the entry has no edge.
They suggested two fixes: measure MFE as a multiple of the stop distance, and compare against the same exits applied to random entry times. If the real losers don't beat the random ones, it isn't an exit problem.
That was right, so I built it. This is what came out, including the part where I got it wrong first.
The control
For each losing trade, the tool replays 100 entries at random bar opens, with:
- the same side (buy or sell),
- the same loss distance, used as a stop,
- the same holding time.
When one bar reaches both the stop and a new high, the stop is taken first, so random entries aren't flattered. Real trades are measured without the range of the bar they opened in (the fill was somewhere inside it), so the random ones are measured the same way.
The random trades that end in a loss are then classified with the same rule as the real ones: "in profit first" if the open profit reached at least half the loss distance, "wrong right away" if it stayed under 15% of it. Then a one-sided test (about 95%) asks whether the real share is higher than the random share.
If it isn't, the tool no longer says "exit problem" or "entry problem". It says the share is no higher than random entries give, and drops the suggestion that goes with it.
The part I got wrong
My first version measured each random trade's open profit against its own loss. A random trade that timed out down 2 pips with 3 pips of open profit along the way counted as "in profit first". On a test with flat, quiet bars, 98% of random losers came out as exit problems.
On the bundled sample, that version said the exit finding was noise too: 34% for the real losers, 43% for random entries.
The fix is what the comment actually said: measure against the real loser's loss distance, like a multiple of R. A random trade only counts as "in profit first" if it went as far your way as the real trade's loss was.
What the sample says now
The sample is a breakout EA on synthetic EURUSD M15 data, 136 trades, 90 losers.
| Kind of loser | This EA | Random entries |
|---|---|---|
| In profit first | 34% | 25% |
| Went wrong right away | 33% | 39% |
| Went wrong right away (3 pips cost) | 44% | 52% |
The exit finding holds (z ≈ 1.96). The entry finding doesn't: random entries go wrong right away at least as often as this EA does.
That second line changed something I had published. The guide on reading MT5 reports said that once you subtract a 3-pip cost, this EA's losses "lean towards the entry" (40 entry problems against 22 exit problems). Without a control, that sounded fair. With one, 44% against 52% for random entries says the opposite: the entries are no worse than random. The cost moves both groups the same way. I took the sentence out.
Other things the comments changed
The same reader left a second comment on the post about re-running on save, and a few smaller things came out of both:
- Same-bar ties. When a bar touches both the target and the stop, the engine assumes the stop came first. The exit analysis now counts those trades and shows how much profit would change if the target had come first. On the demo's hourly bars with 1% levels the count is 0, since an hourly bar there moves far less than the 2% between the levels. On tighter levels it won't be.
- Size-only changes in the diff. The strategy in that post sizes from equity, so one changed exit resizes every later trade. The diff only counted a trade as "changed" when its exit moved, so those weren't in the count, but the PnL line mixed them in. They now have their own line: same bars, size changed, with their PnL.
- Heatmaps say how many cells the best one was picked from. More cells means a higher best cell by luck alone.
Limits of the control
- Random entries are drawn from the whole test period. If your EA only trades London open, the control doesn't match that. A control matched on time of day is the obvious next step.
- With 90 losers the test is rough. It can tell "clearly more than random" from "not clearly", but a share 5 points above random won't pass.
- It says whether the split is real, not what to change. A real exit problem still needs a tested change to the exit, on a different period than the one you found it on.
The analyser is free, runs in the browser, and the report never leaves your machine:
If you test EAs, I'd like to know whether a time-of-day matched control would change your numbers, and what else you would compare against.
Top comments (3)
I'd start with a matched control: same side, session, weekday and a volatility bucket measured before entry. Keep the stop, holding-time and same-bar rules unchanged. Otherwise the comparison may partly measure when the EA trades rather than how it enters.
One uncertainty check: resample whole trading days and rerun the real-minus-control gap. The 100 random entries per loser reuse the same price history, so I would not count them as 100 independent observations. With z near 1.96, I'd want to see whether the conclusion survives that change.
I'd also show the distribution of MFE/R, not only the threshold split. That would reveal whether the difference comes from many small moves or a few large ones. These are proposed checks; I haven't run your analyser.
Thanks, this was really useful. You were right, so I built all three.
Resampling by day alone, the exit result still held. But once random entries were matched on session and volatility, random went from 25% to 27%, and the difference from the real 34% was no longer clearly above zero. So part of it was just when the EA trades.
On your last question, it's many small moves. The remaining gap is all just above the 0.5R cutoff, not a few trades that ran far.
I've updated the guide. A bit annoying to lose the result, but better than leaving it wrong.
That changes the conclusion in a useful way: the unmatched control was partly measuring the trading window. With the matched gap no longer clearly above zero, I would leave the exit diagnosis unresolved rather than turn it into evidence that there is no effect.
The pile-up just above 0.5R is useful too. A fixed sensitivity plot around that cutoff would show whether the label depends on a small threshold change. I would show the whole curve, not pick the cutoff with the best gap. Then keep the rule and matching choices fixed for a later, untouched period.
Thanks for updating the guide and reporting the result that weakened the original claim. I haven't run the updated analyser; this is based on the results you described.