🧬 MT4 / MT5 Genetic Copy-Trade Lab

A local, walker-style evolutionary search for copy-signal filters. Import a chronological trade CSV; candidate genomes compete on the first 70% of trades using selection, crossover and mutation, then the chosen filter is measured on the untouched final 30%. Your data stays in this browser tab and is not uploaded or saved automatically.

No system can find the “right deal” every time. This is a historical research/backtest aid, not a profit predictor. Markets change and genetic search can overfit. It never connects to a broker, sends an order, copies a live signal, or guarantees a result. Start in a MetaTrader Strategy Tester/demo environment and get qualified financial advice where needed.

At least 30 valid trades are needed. Include a parseable time / datetime / timestamp so rows are sorted oldest to newest. Without readable times, CSV order is treated as chronology, so put the oldest row first. Keep one symbol per run (or normalize point values consistently). The pnl_points column must be signed and should already include trading costs. If you instead provide entry/close prices and side, enter the broker point size below.

CSV fields the lab understands

  • pnl_points (or profit_points / points), or side + entry_price + close_price.
  • Optional signal features: signal_score (0–100), spread_points, copy_delay_seconds, side, and time.
  • Optional exit excursions: mfe_points and mae_points on every row to test take-profit / stop-loss thresholds. If both thresholds were touched, the lab assumes the stop was hit first because MFE / MAE does not reveal intrabar order.

MT4 / MT5 history reports vary by broker and may not contain signal score, copy delay or maximum favourable/adverse excursion. Signal scores must be 0–100; MFE / MAE are non-negative point magnitudes. Add those fields from your own EA/logging if you want the search to learn them, and use only values known at copy time—not information learned after the trade. A basic account-history export alone cannot reveal a future winning trade.

Example row format

time,symbol,side,pnl_points,signal_score,spread_points,copy_delay_seconds,mfe_points,mae_points
2026-01-02T09:00:00,EURUSD,buy,18,78,12,1,25,6

Use the same broker “point” definition throughout. If you only have entry and close prices, set point size explicitly (for example, 0.00001 for a five-digit EUR/USD quote; check your symbol specification).

Evolution settings

Fitness rewards net points and penalizes historical drawdown and losing streaks. Candidates must retain at least 15% of training trades (minimum four) so the search cannot “win” by selecting one lucky trade.

Import or paste a normalized trade CSV, then run the offline evolutionary search.

Results will show the all-trades baseline beside the evolved filter for training and holdout periods.

MT4 / MT5 filter adapters

After a run, these produce MQL4 and MQL5 gate snippets for an existing EA. They only accept or reject a signal; they contain no order-sending code. Replace the example score, side and age arguments with variables from your own copier.

Integration boundary: these are not complete Expert Advisors and do not connect to a signal provider, read credentials, size positions, place orders, or manage exits. Your EA must supply score (0–100), side (+1 buy / −1 sell), and signal age in seconds. A threshold learned on one account, broker or period may fail elsewhere.