Financial Trading Software — Turtle
Turtle · Algorithmic Trading Lab
Turtle is a live algorithmic-trading research platform I designed and built — and it is developed almost entirely through agentic AI coding (Claude Code), with me directing the architecture and reviewing every change. It ingests raw market tick data, builds candles, detects trading setups, backtests them against a real MetaTrader 5 execution engine, and manages live orders with realistic bid/ask spread handling. A machine-learning entry filter is in research (below).
What’s proven here is the validation harness that catches simulation lies. The trading edge itself is still under test — and the honesty about that is the point.
What it is
Not a toy backtester. Turtle is a full research-to-production loop for a trading strategy:
- Real-time data pipeline — ingests broker tick data, builds M1/M5/M15 candles, and keeps a synchronized view of several instruments.
- Strategy tester — a browser cockpit that replays years of ticks, scores a strategy on win rate, profit factor and drawdown, and surfaces every trade to inspect candle by candle.
- Expert Advisors (MQL5) — the automated strategies that run inside MetaTrader 5, versioned from hypothesis to live deployment.
- Machine-learning entry filter — a second brain being trained to score setups (in research; ships off by default).
- Live engine — a Python service that reads live quotes over a browser bridge and manages positions.
Inside the lab





The engineering discipline that matters most
The lesson the whole project is built around: a naive Python backtest lies. Early on, a Python replay of 163 real entries predicted +$876 — the same trades, filled for real, returned −$657. A tick-door simulation promised an 89% win rate; live fills gave 57%. Python fills at the price it wants, with no spread, slippage, latency or requotes, and it asks “did the low reach my stop?” using the very candle it is trading inside — so the answer is baked into the question.
So Turtle treats a Python result as a hypothesis only, and promotes a setting only when it survives MetaTrader 5’s own Strategy Tester (random execution delay, target held at the broker). To keep fast iteration without losing that rigour, I built an internal tester and then validated it against 16 MT5 runs — 52,782 trades — with an automated parity check before trusting it to stand in for MT5. That rule — validate against reality, never against a simulation of your own making — is the backbone of the system, and the same instinct I bring to production software.
What the AI got wrong, and I caught. The AI-written tester once filled moved stops (break-even, trailing) at the entry tick instead of when price actually reached them — a look-ahead bug that silently flattered the results. I caught it in review; the fix searches the real tick stream forward from each entry. Agentic AI writes the code fast, but the judgement about what is correct stays with the engineer.
The machine-learning layer
A second entry filter is architected the way quant desks build one (after López de Prado), not the way tutorials do:
- Triple-barrier labelling — each bar labelled by what the market did next (an upper or lower barrier touched first within a time limit).
- Purged, embargoed cross-validation — so the model never sees its own test fold and results don’t leak across time.
- A stacked ensemble — gradient-boosted base learners (LightGBM, CatBoost) with a logistic meta-learner, feature-selected with SHAP.
- ONNX export — so the trained model can run inside the MQL5 Expert Advisor at bar close, once it earns promotion.
Honest status: this filter ships disabled by default. It has not yet beaten the MT5 baseline out of sample — its gate sits inside the random band — so by the project’s own promotion rule it stays off until it does. A companion lab trains eleven classifiers (random forest, SVM, neural net, XGBoost and more) as meta-labels on the strategy’s own trades, every one a hypothesis until it clears MT5. Building the apparatus and refusing to switch it on until it proves an edge is the discipline, not a gap in it.
Architecture
A tick ingester feeds a candle builder; a detection engine scans for setups. The Python research tester and the live MQL5 Expert Advisors are two implementations of the strategy, kept in lock-step by an automated parity check (validated across 16 MT5 runs / 52,782 trades) so research and production stay aligned. Background workers watch the market, collect fills and report. Dashboards are served by lightweight Python web servers (standard-library http.server) and driven live through the Chrome DevTools Protocol.
Tech
Python · MQL5 / MetaTrader 5 · real-time tick processing · NumPy / pandas · scikit-learn / LightGBM / CatBoost / ONNX · standard-library HTTP dashboards · WebSocket & Chrome DevTools Protocol automation · SQLite · agentic AI development (Claude Code)
