Live · Phase 1

AI Forex Bot

AI regime detector + MQL5 EA executor — XAUUSD H1, Wine MT5 headless ops.

The Bet

AI sebagai strategist. MQL5 EA sebagai executor. Cost $2/bulan.

Pipeline

End-to-end execution.

Tiap H1 close, AI klasifikasi regime → Python signal service → MQL5 EA execute. Sub-15s decision-to-fill. Public stats push tiap 60s ke portfolio.

  1. AI regime detector

    Tiap candle close H1, AI klasifikasi regime: TREND_UP / TREND_DOWN / RANGE / NEWS_VOLATILE. Input 50 candles OHLC + economic calendar window. Provider: Anthropic API.

  2. Signal service Python Flask

    Receive AI output → translate ke action {BUY, SELL, FLAT}. Risk filter (drawdown guard, market hours, lot validate). POST ke MQL5 EA via local socket.

  3. MQL5 EA executor

    Custom EA ~250 lines. Read signal file. Place MARKET order. Position size per ATR(14), SL 1.5×ATR, TP 2.5×ATR.

  4. Wine MT5 di Linux VPS headless

    Wine 9 + xvfb-run + x11vnc localhost-only. SSH tunnel untuk monitoring visual. CLI flags /portable /login auto-login. MetaEditor /compile CLI build EA.

  5. Telegram alert wire

    Per fill / close / drawdown alert kirim Telegram dengan dedup (last message_id state) — anti-spam pattern.

  6. Public stats push

    Cron timer push /public/stats Flask endpoint → FTP upload stats.json ke portfolio domain tiap 60 detik. Zero-load fetch dari visitor (file static).

Lessons

Yang dipelajari hari 1.

Bot live butuh awareness yang ga muncul di backtest. Catat di memory + adjust deploy procedure.

XAUUSD min lot trap
Modal kecil + lot 0.01 XAUUSD + SL 2×ATR → real risk multiplier 5× dari risk-target configured. Untuk modal kecil pindah EURUSD atau scale modal up.
Market hours awareness
Daily settlement 21:00-22:00 UTC bikin order reject 'Market closed'. Weekend Fri 22 UTC → Sun 22 UTC closed. Fire bot OUTSIDE window.
Stack

Production infra.

AI Anthropic API $2/mo regime detection
Trading MQL5 EA Wine MT5 headless
Pair · TF XAUUSD H1 Phase 1 single-pair
Risk model ATR(14) SL 1.5× · TP 2.5×
  1. P1

    Foundation & Live Deploy

    Shipped
    • Wine 9 + xvfb + MT5 di Linux VPS headless
    • Custom EA MQL5 (~250 lines) execution path
    • AI signal service Python Flask + Anthropic API
    • Telegram alert wired
    • Public dashboard auto-refresh stats
    • Live deployment · real account
    Shipped · 14 Mei 2026
  2. P1.5

    Live Monitoring & Validation

    In flight

    Collect 10+ actual trades, validate WR + lot calc behavior in real fills, audit signal journal for AI quality

  3. P2

    Adaptive Learning Loop

    Queued

    AI belajar dari past trade outcomes — feed lessons.jsonl ke system prompt biar setiap signal next adapt dari kesalahan/keberhasilan sebelumnya

    Est · 1 hari build Impact · WR boost ~50% → ~55-60% setelah 50+ trade data
  4. P3

    News Intelligence

    Queued

    Scrape ForexFactory calendar + sentiment scoring. Pre-trade gate auto-pause saat news high-impact <4 jam (NFP/FOMC/CPI)

    Est · 2 hari build Impact · Avoid catastrophic news-driven loss, prevent basket grid wipe
  5. P4

    Multi-Timeframe Analysis

    Queued

    M15 entry timing + H1 regime + H4 trend + D1 macro confluence — AI decision dengan 4-tier validation

    Est · 1 hari build Impact · Better entry precision, reduce false signal rate
  6. P5

    Multi-Pair Scaling

    Queued

    Diversify ke EURUSD (London session) + USDJPY (Tokyo session) + XAUUSD (NY session). Magic number per pair, risk allocation 1% each

    Impact · Capture more opportunities across timezone, smoother equity curve
  7. P6

    Equity Curve Live Chart

    Queued

    Public chart D3.js / sparkline equity history sejak Phase 1 start. Real-time visualization dari journal SQLite

    Est · 0.5 hari build Impact · Transparency for portfolio visitors, demonstrate consistency
  8. P7

    Cost Optimization (Hybrid Provider)

    Queued

    Hybrid Claude (decision penting) + Gemini Flash free tier (routine scan). Atau switch DeepSeek 7x lebih murah

    Impact · Cost reduction 60-80% kalau bot scale
Next up

More live builds.

Six SaaS + two trading bots, all running. Case studies dengan narrative + roadmap transparan.