feat: live trading, multi-pair backtest, README, CI workflow

- Add live trading loop (live.rs) with MT5 pending order placement,
  state persistence, and per-symbol tokio task for multi-pair
- Extract backtest engine to backtest.rs and shared helpers to helpers.rs
- Multi-pair support via SYMBOLS env var (comma-separated)
- Add GitHub Actions workflow: Linux musl + Windows release binaries
- Add README with strategy docs, config reference, backtest results
- Clean up warnings, remove unused env vars, tighten .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
romysaputrasihananda
2026-06-10 13:31:53 +07:00
parent ddd8c98af5
commit 7d094591b8
13 changed files with 1174 additions and 503 deletions
+30 -29
View File
@@ -2,40 +2,41 @@
MT5_BASE_URL=http://localhost:8080
# ── Symbol & Timeframe ──────────────────────────────────────────────────────
# XAUUSDm: flagship (PF=1.47, +21606% over 18m)
# XAGUSDm: best risk-adjusted (PF=1.63, Max DD only -$192)
# BTCUSDm: viable (PF=1.25), USOILm: viable (PF=1.32)
# EURUSDm/GBPUSDm: negative edge — not recommended
# Single pair:
SYMBOL=XAUUSDm
# Multi pair (comma-sep, overrides SYMBOL):
# SYMBOLS=XAUUSDm,XAGUSDm
TIMEFRAME=M5
# ── Risk ─────────────────────────────────────────────────────────────────────
RISK_PCT=0.01
# ── Momentum Candle Thresholds ───────────────────────────────────────────────
BODY_PCT_MIN=0.5
CLOSE_PCT_MIN=0.8
# ── FVG Setup ────────────────────────────────────────────────────────────────
FVG_EXPIRY_CANDLES=10
MIN_FVG_PIPS=1
MIN_SL_PIPS=5
SL_BUFFER=0
MIN_RR=1.5
# TIMEOUT_CANDLES=0
# ── Friction ─────────────────────────────────────────────────────────────────
COMMISSION_PER_LOT=7
SLIPPAGE_POINTS=2
SPREAD_OVERRIDE=0
# ── EMA Trend Filter ─────────────────────────────────────────────────────────
EMA_PERIOD=20
# ── Backtest ─────────────────────────────────────────────────────────────────
BACKTEST_BALANCE=600
BACKTEST_CANDLES=99000
BACKTEST_CANDLES=50000
# DATE_FROM=2025-01-01
# DATE_TO=2025-12-31
# ── Risk ─────────────────────────────────────────────────────────────────────
RISK_PCT=0.01 # risk per trade (0.01 = 1%)
# ── Momentum Candle Thresholds ───────────────────────────────────────────────
BODY_PCT_MIN=0.5 # minimum body/range ratio — 0.50 optimal (PF 1.47 vs 1.43 at 0.60)
CLOSE_PCT_MIN=0.8 # close must be in top/bottom 20% of range
# ── FVG Setup ────────────────────────────────────────────────────────────────
FVG_EXPIRY_CANDLES=10 # invalidate setup after N candles without fill
MIN_FVG_PIPS=1 # minimum FVG zone width in pips (rejects non-gap patterns)
MIN_SL_PIPS=5 # minimum SL distance in pips (rejects degenerate setups)
SL_BUFFER=0 # extra buffer beyond impulse candle extreme for SL
MIN_RR=1.5 # minimum reward:risk ratio
TIMEOUT_CANDLES=0 # force close after N candles (0 = disabled)
# ── Friction ─────────────────────────────────────────────────────────────────
COMMISSION_PER_LOT=7 # round-trip commission in USD
SLIPPAGE_POINTS=5 # extra SL slippage in MT5 points
SPREAD_OVERRIDE=0 # override spread (0 = Zero/Raw account)
# ── EMA Trend Filter ─────────────────────────────────────────────────────────
# Critical: without EMA filter strategy loses money on XAU
# EMA20 is recommended (EMA10 overfits, EMA50 reduces returns significantly)
EMA_PERIOD=20
# ── Live Trading ─────────────────────────────────────────────────────────────
# LIVE=true
# LIVE_POLL_SECS=30