🚀 AI‑Powered Stock Trading with MetaTrader

🎯 What Inspired Me

I wanted to bridge the gap between high-frequency trading and AI, and MetaTrader’s new AI Copilot + ONNX integration was the perfect playground . I dreamed of a system where you could describe a strategy in plain English and let a bot transform it into a fully functioning trading robot.

🧠 What I Learned

  • NLP-to-code translation using MetaEditor Copilot: I learned how giving natural‑language prompts (e.g. “Buy when RSI dips below 30”) generates working MQL5 snippets .
  • ONNX deployment: I grew familiar with exporting Python-trained models
  • Backtesting / risk tuning: Testing across multiple data sets taught me how small tweaks in preprocessing (scaling, encoding) dramatically affect live performance.

🛠️ How I Built It

  1. Prototype in Python: Collected price/sentiment data → trained models → exported to ONNX.
  2. MetaEditor setup: Loaded ONNX, used Netron to inspect model layers.
  3. Copilot integration: Wrote English prompts inside MetaEditor, generated initial MQL5 EA code.
  4. Strategy coder: Wrapped the ONNX inference into an Expert Advisor template, feeding trading signals to MetaTrader’s execution engine.
  5. Iterative testing: Backtested on historical data, refined thresholds, retrained models, and managed risk limits.

⚠️ Challenges & How I Overcame Them

  • Data drift: Model performance degraded over time. Solution: added retraining routines every month and integrated volume-based features for robustness.
  • ONNX quirks: Some operators weren’t supported natively in MQL5. I rewrote parts of the graph or swapped to float16-compatible layers
  • Copilot limitations: It sometimes mis-generated code. I caught logical bugs by manual code review and unit tests inside MT5’s strategy tester.

** The result:**
A no‑code/low‑code pipeline where a trader can describe a strategy in plain language, load a pre-trained ONNX model, and hit “Deploy.” It auto-generates a backtested EA ready to run on real markets—with clear audit trails and model transparency.

Built With

Share this project:

Updates