Strata Kit
Tools and rules for people who build MT5 expert advisors with an AI agent (Claude Code, Cursor, Codex…), fromStrata, a free tester for trading systems and signals.
Online, no install: paste a link to an MQL5, FX Blue, SignalStart, ZuluTrade or Collective2 signal, or upload an MT5report, at stratatester.com: an A–F audit with red flags, a stress test, and thechance to pass an FTMO, The5ers or FundedNext challenge replayed from every day of the history.
In Claude: add the MCP connector https://stratatester.com/mcp?key=<your-key> (tools: audit_system,prop_chance, compare_systems, list_prop_programmes, top_systems).
Tools and rules for people who build MT5 expert advisors with an AI agent (Claude Code, Cursor, Codex…).
| file | what it is |
|---|---|
CLAUDE.md, AGENTS.md |
rules for the agent: what to check, what not to trust, how to report |
LAWS.md |
30 testing laws with the measurements behind them |
MARKET_CHECKLIST.md |
why the MQL5 Market validator rejects EAs and how to fix it |
skills/ |
Claude Code skills: ea-build, ea-test, ea-audit, market-check |
strata/ |
the engine: spec → .mq5, audit of any report, metrics. Python 3.7+, no dependencies |
examples/ |
six starter specs (most of them fail the lab - that is the lesson) |
Install into your EA project
./install.sh ~/my-ea-project # copies the skills to .claude/skills and the agent rules to CLAUDE.md / AGENTS.md
Use
python3 -m strata audit MyEA_report.htm # MT5 tester report
python3 -m strata audit history.htm --pub 2025-09-01 # MT5 account history, judged after a release date
python3 -m strata audit myfxbook.csv --compare tester.htm
python3 -m strata build examples/ema_cross.json -o EmaCross.mq5
python3 -m strata test examples/ema_cross.json # full lab; needs the bt backtester (STRATA_BT)
audit reads MT5 tester reports (.htm, UTF-16 as saved by MT5), MT5 account history reports, myfxbook CSVexports and any CSV with open time, close time, side and profit columns.
The spec
{
"name": "EmaCross", "symbol": "EURUSD", "timeframe": "H1", "direction": "both",
"indicators": [{"id": "fast", "type": "EMA", "period": 20}, {"id": "slow", "type": "EMA", "period": 50}],
"long": {"mode": "all", "rules": [{"a": "fast", "op": "cross_above", "b": "slow"}]},
"short": "mirror",
"filters": {"hour_from": 7, "hour_to": 20},
"exit": {"sl": {"mode": "atr", "value": 2}, "tp": {"mode": "rr", "value": 1.5}, "trail": {"value": 0}},
"risk": {"mode": "percent", "value": 1.0}
}
Indicators: SMA, EMA, RSI, CCI, ATR, ADX (.plus, .minus), BANDS (.upper, .middle, .lower),MACD (.signal), STOCH (.k, .d), DONCHIAN (.upper, .lower, .middle; the channel of the bars before thesignal bar, so price.close > don.upper is a breakout), MOMENTUM. Operators: >, <, >=, <=,cross_above, cross_below. "short": "mirror" flips operators, bands and oscillator levels around their centre.
More blocks, entries and exits
Any indicator takes "tf": "H4" (M15, M30, H1, H4, D1, W1) to read a higher timeframe on closed bars. Extra types:SAR (step, max), KELTNER (period, mult; .upper/.middle/.lower), ICHIMOKU (.tenkan/.kijun/.span_a/.span_b;chikou is left out because it is drawn in the past), PIVOT (daily .p/.r1/.s1/.r2/.s2), SESSION (from, to hours;.high/.low of today's window once it has closed, an opening-range breakout), CANDLE (.engulf/.pin/.inside/.dir,+1 bullish, -1 bearish). "entry": {"type": "stop"|"limit", "mode": "atr"|"hl", "value": 0.3, "bars": 10, "expiry": 4}places a pending order instead of a market entry. "exit_long": {"rules": [...]} closes a buy on a condition (sellsmirrored), "exit": {"partial": {"rr": 1, "pct": 50, "be": true}} takes part of the position off at 1x the stop.
Your own function as a filter (CUSTOM)
{"id": "deriv", "type": "CUSTOM", "a": 4, "b": 5, "c": 100, "centre": 0,
"code": "... body of double F(int shift, double a, double b, double c) ..."}
shift is the closed bar to evaluate, a b c are your parameters (they become EA inputs deriv_A/B/C and takepart in the ±20% neighbour test). Return EMPTY_VALUE while data is short. Use it in rules like any indicator:{"a": "deriv", "op": ">", "b": 1.5}. centre is where the mirror flips it for the sell side (null = no flip).The default body (used when code is empty) is the price derivative "4-5-100": z-score of the 4th finite differenceof SMA(5) of close over 100 bars. DLL imports, network and system calls are refused.
Testing your own .mq5
python3 -m strata test takes a spec; to test a finished expert use the web lab ("My MQL5 code") or{"mode": "code", "code": "<the .mq5 text>", "name": "MyEA", "symbol": "XAUUSD", "timeframe": "H1", "sets": {"Input": "value"}, "fixed": ["InputNotToVary"]} as the spec file. Numeric inputs that look like money,time, magic or display settings are kept fixed in the neighbour test; list others in fixed.
The lab stages
"pipeline": {"preset": "quick" | "standard" | "full", "thresholds": {...}} in the spec chooses the depth:parameter space (8/16/24 sets moved ±25%, SPP median), a 4x4 walk-forward matrix re-optimised in every window,Monte Carlo (reshuffle, 10% of trades missed, worse fills), noisy price history, entry one bar late, neighbouringsymbols and timeframes, and real broker ticks for gold. python3 -m strata build spec.json writes MQL5;builder.generate(spec, 'mq4') writes the same expert in MQL4.
Strata gives no investment advice.