⚡ Singapore SME Trading Automation

Gold Trading
AI Agent

An AI-powered trading agent for MetaTrader 4 — combining LLM decision-making with ZeroMQ bridge architecture to autonomously buy and sell XAUUSD (gold). Built by Kopi Agent.

Full-Stack Trading Pipeline

Four layers from user interface to broker execution. Each layer is isolated, testable, and independently deployable.

🖥️ Layer 1 — User Interface
Telegram bot + Web dashboard for monitoring, manual override, PnL snapshots
01
🧠 Layer 2 — AI Decision Engine (Python)
LLM-powered analysis (market data → signal → decision), risk manager, trade logger
02
🔗 Layer 3 — ZeroMQ Bridge
Real-time bid/ask streaming (Python → MT4) + order execution (MT4 → Python)
03
📈 Layer 4 — MetaTrader 4 EA (MQL4)
OrderSend/OrderClose, position monitoring, balance/equity streaming via ZeroMQ
04
🏦 Layer 5 — Broker Execution
XAUUSD (Gold) — ECN/STP broker, demo account → live account
05

MT4 API Comparison

Four ways to connect external agents to MT4. ZeroMQ bridge offers the best balance of speed, control, and cost.

☕ ZeroMQ Bridge
90 — Real-time, free, full control
90%
🌐 WebRequest (MQL4)
55 — Polling latency, SSL limits
55%
💰 Commercial API
70 — Easy setup but monthly cost
70%
🏛️ FIX Protocol
80 — Institutional, high min deposit
80%

How Orders Flow Through the System

Every buy/sell signal passes through a 5-stage pipeline — from AI analysis to broker execution and back.

👤
User
Telegram / Web
🧠
Layer 2
AI Engine
🔗
Layer 3
ZeroMQ Bridge
📈
Layer 4
MT4 EA
🏦
Layer 5
Broker

How the AI Decides to Trade

The LLM doesn't guess — it follows a structured pipeline of data → analysis → signal → execution with risk gates at every step.

AI Market Indicators Sentiment Risk Check News Price Execute

The AI engine ingests price, indicators, news, and sentiment → runs risk gates → outputs a structured trade signal

What Makes This Agent Different

Not a black-box EA — a transparent, AI-driven system you can monitor and override.

🧠
LLM-Powered Decisions
No hardcoded rules. The LLM analyzes price action, technical indicators, and market news to decide buy/sell/hold — with full reasoning logged.
🔗
ZeroMQ Real-Time Bridge
Sub-millisecond latency between Python AI and MT4. Streams bid/ask ticks live and executes orders within the same tick.
🛡️
Multi-Layer Risk Management
Pre-trade: max risk %, position sizing, spread check. Run-time: max drawdown, daily loss limit. Post-trade: PnL tracking and circuit breaker.
📱
Telegram Monitoring & Override
Get trade alerts, equity snapshots, and error reports on Telegram. Human override available — stop the agent or force-close positions remotely.

Demo → Production Roadmap

Start with demo account (no risk), validate the AI's decisions, then graduate to live. Drag the slider to compare.

Phase 1
🧪 Demo Mode (Risk-Free)
  • Demo account — virtual $10,000
  • AI trades with simulated execution
  • Paper trades only, no real money
  • Full trade log + AI reasoning visible
  • Track win rate, drawdown, Sharpe
  • Tune & retrain AI on your data
Phase 2
🚀 Live Production
  • Real broker account — funded with capital
  • Live execution via MT4 EA
  • Telegram alerts for every fill
  • Risk manager enforces limits
  • Human override via Telegram
  • Daily PnL reports + audit trail

Two-Week Build Timeline

From concept to demo-ready trading agent — deployable in 14 days.

Day 1-2
Infrastructure Setup
Provision Windows VPS · Install MT4 + broker demo account · Set up Python environment · Verify ZeroMQ connectivity
Day 3-5
MQL4 EA + ZeroMQ Bridge
Write EA with ZeroMQ REP socket · Implement OrderSend/OrderClose/Modify · Stream tick data + balance/equity to Python
Day 6-8
AI Decision Engine
LLM integration (OpenAI Anthropic/local) · Market data pipeline · Structured trade signal output · Confidence scoring
Day 9-11
Risk Manager + Trade Logger
Pre-trade risk checks · Max drawdown circuit breaker · SQLite trade journal · ATR-based stop/target calculation
Day 12-14
Telegram Integration + Demo Launch
Telegram bot for alerts/override/status · Demo account live trading · 2-week validation period · Performance report

Gold (XAUUSD) Trading Profile

Gold behaves differently from forex pairs — understand these factors before automated trading.

📊
20-50
Spread (pips, standard)
13:00-17:00
Peak Volatility (GMT)
💵
5-10%
Margin Requirement
📉
Inverse
DXY Correlation
🛡️
High
Safe-Haven Sensitivity
📰
NFP / CPI / FOMC
Key Economic Events

Risk Management Framework

Multiple layers of protection — because automatic trading should never mean unattended risk.

Position Sizing (≤2% per trade) Optimal
Stop Loss (ATR × 1.5–2.0) Active
Daily Loss Limit (-5%) Protected
Max Concurrent Positions 1-2
Weekly Drawdown Limit (-10%) Critical

🔒 Circuit Breaker

If any limit is hit → all positions closed → agent pauses → Telegram notification sent

Deliver as a Product

Package and sell this trading agent to Singapore SME traders, prop firms, and retail investors.

🧪
Demo License
$299
One-time · Non-trading
  • Full framework code + MQL4 EA
  • Demo account setup guide
  • AI decision engine + risk manager
  • Telegram monitoring included
  • Email support (48h)
🏢
White-Label
$4,999
Full rights + resell
  • Full source code ownership
  • Rebrand as your own product
  • Custom strategy modules
  • Multi-broker support
  • Direct API access for clients
  • 6-month support + updates