Random Exit Benchmark
"Exits matter more than entries" is repeated constantly in trading forums with essentially no supporting measurement. This EA provides one: its entry rule is deliberately boring and fixed - it alternates Buy and Sell on a plain bar-count schedule, with zero market analysis, so the entry side of every trade is identical in kind. What varies, trade to trade, is the exit: a randomly drawn stop distance, a randomly drawn target distance, and roughly a third of trades (configurable) get a randomly drawn holding-time exit instead of relying on the target at all. A hard safety stop is always attached regardless of exit style, so a random holding-time choice can never turn into an unbounded loss. Because the entry logic never changes, any spread in the resulting trade outcomes is attributable to exit randomness and ordinary market noise, not to entry cleverness - a measured answer, over this EA's own running statistics broken down by which exit style actually closed each trade (stop hit, target hit, or time exit), to how much of a system's result plausibly comes from the exit alone. It does not claim to prove a general law about all trading systems - it demonstrates the measurement on live/demo trades, honestly, with real money-shaped mechanics (spread, stop distances, broker fills) rather than a purely theoretical argument. Notes and limitations This EA places real trades and is a research tool, not a trading strategy - it has no market edge by design, since its entries carry no analysis at all. Run it on a demo account only. A single run's statistics are one sample from a random process; treat the category breakdown as illustrative, not as a statistically settled verdict, and run it for a meaningful number of trades before drawing conclusions. Broker execution (slippage, requotes, spread at the moment of entry) affects results the same way it would any live system and is not factored out.
Expert advisor · MT4 · v1.0 · Free
About Random Exit Benchmark
Random Exit Benchmark is an expert advisor (trading robot) for MetaTrader 4. It has 13 settings, such as Lots, Bars between entries and Min stop pips. MQL source code included.
Files in the download: RandomExitBenchmark.ex4, RandomExitBenchmark.mq4, RandomExitBenchmark.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Lots | 0.01 | Fixed lot size for every entry |
| Bars between entries | 5 | Bars to wait after a trade closes before the next fixed entry |
| Min stop pips | 8 | Random stop-loss distance, minimum (pips) |
| Max stop pips | 25 | Random stop-loss distance, maximum (pips) |
| Min target pips | 8 | Random take-profit distance, minimum (pips) |
| Max target pips | 30 | Random take-profit distance, maximum (pips) |
| Time exit probability percent | 33 | Chance (%) a trade is exited by a random holding time instead of its target |
| Min hold bars | 3 | Random holding-time exit, minimum bars |
| Max hold bars | 20 | Random holding-time exit, maximum bars |
| Safety stop pips | 60 | Hard stop ALWAYS attached, even on a time-exit trade - caps worst case |
| Max spread pips | 5 | Refuse a new entry when the spread exceeds this |
| Magic number | 428001 | Magic number for this EA's own orders |
| Random seed | 0 | 0 = seed from GetTickCount() (different every run); non-zero = reproducible sequence |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: MT4 Expert Advisor · MQL4 Source Code