Ongoing AI Solution

Algorithmic Forex Trading Systems — MT5 Strategy Research & Execution Suite

Eight trading systems built to the same rule: no strategy goes live until it survives an honest, cost-realistic, out-of-sample test.

01 — THE PROBLEM

Retail algorithmic trading has a credibility problem, and it's mostly a methodology problem. Strategies are demonstrated with cherry-picked screenshots, backtested on the same data they were tuned on, and priced as if spread, slippage, commission and swap don't exist — so a system that looks like a 3% monthly edge is often a rounding error that the broker eats. The failure modes are specific and repeatable: lookahead bias from indicators computed on unclosed candles, one lucky time window mistaken for an edge, labels that don't match how the trade is actually managed, and backtests that let a trade through at a price no broker would fill. The engineering problem isn't generating signals. It's building infrastructure that can tell a real edge from an artefact, before real money is on it.

02 — OUR SOLUTION

A suite of eight independent trading systems on MetaTrader 5, spanning classical technical strategies, structural price action, machine learning, reinforcement learning, and a transformer foundation model — all built on shared discipline rather than shared code. Every system enforces the same rules: a cost gate that rejects any trade whose target can't clear spread, slippage and commission with margin to spare; ATR-scaled stops, targets and position sizing off a fixed fraction of equity; time stops so dead trades don't hold risk hostage; and confirmation logic that only reads closed candles, so no signal can see the future. Validation is walk-forward by default — models fit on each training window and evaluated on the untouched window after it, with results concatenated out-of-sample and compared against buy-and-hold. Several systems carry an explicit time-consistency check on top, precisely because an earlier promising result turned out to be one favourable window. The research systems are labelled research: the ML, RL, and price-action pipelines ship deliberately without live trading, on the stated principle that edge is proved first and traded second. The ML pipeline uses triple-barrier labelling so the target matches how the trade is actually managed and bakes risk into the label itself, with a hidden Markov model inferring market regime both as a model feature and as a tradeability filter. The RL agent learns in a market simulator where transaction cost is charged on every change of exposure, so it learns to respect costs rather than discovering a strategy that only works for free. The foundation-model system runs Kronos — the open-source financial K-line model — sampling many independent future paths per decision, taking the median forecast return as the edge and the share of agreeing paths as a confidence proxy, and trading only when the edge beats both current volatility and the round-trip cost.

Outcome

Eight self-contained systems with backtest engines, parameter optimisers, sensitivity grids with in-sample/out-of-sample splits, and reporting. The backtesters model bid/ask spread, commission, swap and margin rather than mid-price fills. Live MT5 execution is implemented for the classical strategies; the ML, RL, price-action and confluence systems are held at the research stage by design. Isolated Python environments per system, because a shared install would have quietly replaced one bot's CUDA build with a CPU one.

Key features

  • Live MetaTrader 5 execution with order management, position monitoring, and broker-held stops and targets
  • Event-driven multi-symbol backtester modelling bid/ask, spread, commission, swap and margin
  • Cost gate on every entry — rejects trades whose target can't clear spread, slippage and commission
  • Walk-forward validation with models refit per window and all results reported out-of-sample
  • Time-consistency checks across market segments to catch single-window flukes
  • Confirmation only on closed candles, with higher-timeframe signals mapped forward without lookahead
  • ATR-scaled stops, targets and position sizing against a fixed risk fraction of equity
  • Drawdown halt, maximum concurrent positions, partial close at a target R multiple, and time stops
  • Session filtering and news-event blackout dates for scheduled central-bank volatility
  • EMA trend-pullback strategy on the daily timeframe
  • RSI(2) mean-reversion scalper with a trend filter and per-symbol rolling spread caps
  • Bollinger squeeze-back scalp with per-symbol pip-value handling
  • Market-structure price action — break of structure and change of character, order blocks, fair-value gaps, liquidity sweeps — codified as objective rules
  • Strict-confluence intraday strategy requiring higher-timeframe bias, opening-range break, support/resistance alignment, retest and candle confirmation to all agree
  • GRU sequence classifier over engineered features with triple-barrier labels and HMM regime posteriors
  • Gaussian HMM regime detection used both as model input and as a tradeability filter
  • PPO reinforcement-learning agent trained in a cost-charging market simulator, benchmarked against buy-and-hold
  • Kronos foundation-model inference with Monte Carlo path sampling, median-return edge and path-agreement confidence
  • Chunked broker history download with local CSV caching
  • Parameter sensitivity grids with in-sample and out-of-sample separation
  • Performance analytics, charts, text reports, and HTML dashboards
  • Isolated per-system Python environments to prevent dependency collisions

Tech stack

Python MetaTrader5 API pandas NumPy pandas-ta PyTorch CUDA Stable-Baselines3 Gymnasium hmmlearn scikit-learn Kronos foundation model Hugging Face loguru python-dotenv schedule Matplotlib

Build something similar?

Tell us about your project. We'll share how we'd approach it.

Start a project