Loading…

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

SettingDefaultWhat it does
Lots0.01Fixed lot size for every entry
Bars between entries5Bars to wait after a trade closes before the next fixed entry
Min stop pips8Random stop-loss distance, minimum (pips)
Max stop pips25Random stop-loss distance, maximum (pips)
Min target pips8Random take-profit distance, minimum (pips)
Max target pips30Random take-profit distance, maximum (pips)
Time exit probability percent33Chance (%) a trade is exited by a random holding time instead of its target
Min hold bars3Random holding-time exit, minimum bars
Max hold bars20Random holding-time exit, maximum bars
Safety stop pips60Hard stop ALWAYS attached, even on a time-exit trade - caps worst case
Max spread pips5Refuse a new entry when the spread exceeds this
Magic number428001Magic number for this EA's own orders
Random seed00 = seed from GetTickCount() (different every run); non-zero = reproducible sequence

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria