AI Expert Advisor
  • MQL5 74.2%
  • HTML 14.9%
  • C++ 9.5%
  • C 0.4%
  • Python 0.4%
  • Other 0.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
AnimateDread e37f15edb3 build: tag books-d1-census-1 for the first deploy of the swing-book and census fixes
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 07:16:06 -04:00
.claude . 2026-07-18 17:43:29 -04:00
.clinerules feat: suppress noisy performance warnings unless VerboseMode 2026-07-27 10:58:29 -04:00
Database fix(journal): a virtual firing fills like the real order, and the label pays the spread at its fill 2026-09-08 21:48:13 -04:00
DirectML feat(optimizers): RMSprop, Nesterov and AMSGrad across all four backends 2026-09-04 23:47:19 -04:00
docs feat(altdata): wire everything the sources serve - screens become priors, not gates 2026-08-16 17:29:22 -04:00
Enumerations refactor(inputs): commission out of the EA, 63 inputs down to 22 2026-09-07 19:57:39 -04:00
Expert feat(book): daily and weekly charts are swing books - no session window, no weekly flat 2026-09-09 13:17:00 -04:00
Features feat(setup): the setup owns its trade - delegation, network confluence, feature port, expiry fallback 2026-09-06 12:16:41 -04:00
Market Descriptions Add new research scripts for trading strategy analysis 2026-08-02 12:25:20 -04:00
Marketing/Logo refactor(AI): clean up comments and add conditional compilation guards 2026-07-22 17:17:23 -04:00
Money refactor(trade-mgmt): remove all confidence-scaled trade management 2026-08-25 10:10:20 -04:00
Panel refactor(comments): box headers to stdlib length 2026-08-22 00:30:14 -04:00
Scripts refactor(ea): delete on-chart training - the EA stops learning and starts executing 2026-09-07 17:23:36 -04:00
Signals feat(book): daily and weekly charts are swing books - no session window, no weekly flat 2026-09-09 13:17:00 -04:00
Structures fix(db): per-side pattern journaling + versioned journaling semantics 2026-08-12 10:37:57 -04:00
System refactor(ea): delete on-chart training - the EA stops learning and starts executing 2026-09-07 17:23:36 -04:00
Tests refactor(ea): delete on-chart training - the EA stops learning and starts executing 2026-09-07 17:23:36 -04:00
Trailing Enhance Feature and Topology Interfaces with Bulk Operations and Cache Management 2026-08-25 22:51:50 -04:00
Variables feat(book): Book_Management input - as the book states, or stop/target/time stop only 2026-09-08 21:12:04 -04:00
.gitignore fix(cost): measure the round turn from live Ask-Bid and an input, not from bar history 2026-09-03 13:35:59 -04:00
AI_NETWORK.md fix(ai): fold in the rest of the AI/Impl split - previous commit's git add aborted silently 2026-08-23 21:05:52 -04:00
cpu_directml.log feat(opencl): add feedback alignment support to weight update kernels 2026-07-28 15:01:40 -04:00
DATABASE.md feat: add max-pooling and convolution OpenCL kernels, clean up barrier and signal code 2026-07-13 03:23:39 -04:00
EXPERIMENTS.md feat: make batch normalization mandatory, and record the run-3 results 2026-07-30 08:51:10 -04:00
opencl.log feat(opencl): add feedback alignment support to weight update kernels 2026-07-28 15:01:40 -04:00
PIPELINE_ANALYSIS.md docs(research): pipeline analysis, and the two scripts the research depended on 2026-09-06 01:57:18 -04:00
profiling.csv fix: handle legacy neuron classes in BlendWeightsFrom to avoid UB 2026-07-26 14:45:08 -04:00
README.md docs(research): pipeline analysis, and the two scripts the research depended on 2026-09-06 01:57:18 -04:00
REFACTOR_NOTES.md refactor(ai): extract Layer.mqh and deduplicate AI config 2026-08-01 11:27:28 -04:00
REFACTOR_PLAN.md fix(book): the entry price was wiped by the setup's own other side 2026-09-07 19:57:56 -04:00
SIGNALS.md fix(vote): the classic modules were the live book - inputs, not voters; certify with the live stop 2026-09-06 23:07:53 -04:00
Warrior_EA.md feat: Enhance README and documentation for Warrior_EA project 2026-04-20 19:28:34 -04:00
Warrior_EA.mq5 build: tag books-d1-census-1 for the first deploy of the swing-book and census fixes 2026-09-10 07:16:06 -04:00
Warrior_EA.mqproj refactor(trade-mgmt): remove all confidence-scaled trade management 2026-08-25 10:10:20 -04:00
Warrior_EA_System_Overview.md docs(overview): trade-management enums are placement-only, and pin ordinals 2026-08-25 10:10:46 -04:00

Warrior EA

A production-grade MetaTrader 5 Expert Advisor that trains and trades its own neural networks, written entirely against the standard MQL5 toolchain (a compatible .mq5/.mqh build also runs unmodified in StrategyQuantX/SQX). It fuses classic technical/Wyckoff signal analysis with a custom, from-scratch deep-learning library (dense, convolutional, LSTM, batch-norm) that trains, validates, and deploys itself live on the chart — no external ML runtime, no Python dependency at inference time.

Designed for prop-firm-grade correctness: every subsystem that touches money, capacity, or a deploy decision is built around one governing idea — raw bar count is not the sample size. Overlapping labels, pooled instruments, and correlated bars all get corrected down to an effective, independent sample size before anything is allowed to size a network, weight a loss, or clear a gate.

See PIPELINE_ANALYSIS.md for a source-verified, file:line-cited deep dive into the data pipeline, network sizing, labeling, training loop, and deploy gating — written for technical review, not marketing.

What it does

  • Trains its own models per instrument/timeframe, on the chart, continuously — no offline training step is required to get a first model live.
  • Runs as a fleet: multiple charts train independently but pool label statistics, capacity budgets, and deploy verdicts across instruments through a shared file-based pool, with a heartbeat/revive sweep that detects and restarts charts whose EA has fatally errored (a dead EA still leaves a chart window open — this is checked for).
  • Sizes its own network: hidden-layer depth and width are derived from an overlap-corrected estimate of independent observations, not raw bar count or a fixed hyperparameter, and re-derived (without discarding trained weights) as more data accumulates.
  • Labels itself with a leg-ride pivot label built on a from-scratch, lookahead-free replica of the ZigZag indicator, rather than reading the live indicator's repainting buffer.
  • Trains with a corrected loss: class-prior logit adjustment, money-weighted sampling, and an average-uniqueness correction for overlapping labels, combined into a single per-sample weight.
  • Gates its own deployment: a model only goes live once it clears measurability, coverage, two-sidedness, and a statistical edge test run against the same overlap-corrected sample size used to size it — not the raw row count.
  • Keeps learning after deployment, blending online updates into a shadow network under a rolling-accuracy guardrail, rather than freezing at deploy time.
  • Enforces risk independently of the model: a separate, always-on risk-budget layer (drawdown floors, an expectancy-based trading halt, position-size capping) runs on every tick regardless of what the model or the vote says.

Architecture

Warrior_EA/
├── AI/                 Custom neural-network engine (dense / conv / LSTM / batch-norm)
│   └── Impl/           OpenCL, DirectML, CPU-DLL and pure-MQL5 backend implementations
├── Expert/
│   ├── AIBase/          Feature building, topology sizing, labeling, training, inference
│   ├── Labeling/        Leg-ride label, ZigZag replica, label overlap / effective-N
│   ├── Training/        Deploy gate, pooled cross-instrument gate, training pool
│   ├── Features/        Feature builder, fractional differencing
│   ├── Topology/        Capacity-budgeted layer sizing
│   ├── Signal/          Signal declustering (NMS)
│   ├── Chart/           Chart UI, vote/arrow rendering
│   ├── Persistence/     Model save/load, architecture-change handling
│   └── OnlineLearning/  Post-deployment shadow-network updates
├── Signals/             PAI / CONV / LSTM / HYBRID neural signals + classic indicator votes
├── Variables/           Central inputs, feature mask, money/uniqueness weighting, risk budget
├── Money/               Position-sizing strategies (fixed lot, fixed risk)
├── Trailing/             Trailing-stop strategies
├── Database/             Trade/signal journaling and statistics
├── System/               Infrastructure: alt-data fetch, atomic file I/O, retry/backoff
├── Panel/                In-terminal control panel (CAppDialog)
└── Scripts/              Offline research scripts (indicator param search, tick export)

Getting started

  1. Open Warrior_EA.mq5 in MetaEditor (or SQX) and compile — all dependencies are relative includes within this repository.
  2. Configure feature toggles, labeling, and training parameters in Variables/Inputs.mqh. Most feature-family flags are compile-time constants by design (they key the model's fingerprint), not runtime inputs.
  3. Attach to a chart, enable Algo Trading, and let the EA build its indicator/feature cache and begin training from era 0.
  4. Use the in-terminal control panel to monitor training progress, feature/topology state, and deploy-gate verdicts without needing to read the Experts log.
  5. For a multi-instrument fleet, enable fleet expansion in Expert/FleetExpansion.mqh's symbol list; charts will self-add and self-revive on a 10-minute sweep.

Documentation

Document Covers
PIPELINE_ANALYSIS.md Full pipeline: features, network sizing, labeling, training/optimizer, deploy gating — source-cited
AI_NETWORK.md Neural-network engine internals (layer types, backends, kernels)
SIGNALS.md Signal module catalog (AI and classic)
DATABASE.md Trade/signal persistence schema
EXPERIMENTS.md Research log
Per-directory README.md files Subsystem-local notes

Status

Actively developed against a live and a paper/backtest fleet. Architecture, labeling, and gating logic all change frequently as measurement work continues — treat any document in this repository (including this one) as accurate as of its last commit, not as a permanent contract. PIPELINE_ANALYSIS.md is the one kept closest to current source.

Disclaimer

This is a research and trading system, not investment advice. Automated trading carries a substantial risk of loss. Nothing in this repository should be construed as a recommendation to trade any instrument or strategy.