Commit Graph

23 Commits

Author SHA1 Message Date
romysaputrasihananda 2c02589521 chore(config): v1.4.0 — hybrid-C config (EMA=20, zone=0.75, ATR filter)
Backtest validation (50k candles, XAUUSDm M5, RISK=5%, SESSION=08-13):
  v1.3.0 (no filter)         : +174.7%  PF=1.17  DD=-5482  trades=224
  v1.4-prev (EMA=10+z=0.75)  : +227.7%  PF=2.19  DD=-1965  trades=55
  v1.4 hybrid-C (EMA=20+z=0.75+ATR): +448.7%  PF=2.08  DD=-2669  trades=83

EMA=20 captures more valid setups in trending markets (+83 vs 55 trades)
while zone=0.75 + ATR filter maintain quality (WR 62.7%, PF 2.08).
$5000 → $27,439 over 50k M5 candles (~8 months).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 02:18:22 +07:00
romysaputrasihananda af2dcb244c chore(config): apply autonomous research findings — EMA=10, zone=0.75, ATR+prefill enabled by default
Autonomous 9-phase parameter sweep (20k candles, XAUUSDm, SESSION=08-13):
- EMA=10 sharper trend filter: WR 62% vs 52%, PF 2.23 vs 1.39
- ENTRY_ZONE_PCT=0.75 deeper entry confirmation: DD -1116 vs -3064
- Combined EMA=10 + zone=0.75: PF 2.58, WR 67%, DD -1134 (best overall)
- MIN_FVG_ATR_RATIO=0.3 + MIN_IMPULSE_ATR_RATIO=1.0: quality filter
- SESSION_FROM_UTC=8 / SESSION_TO_UTC=13: confirmed optimal London window
- PRE_FILL_INVALIDATE=true: negligible effect but conceptually sound

Net improvement vs unfiltered: PF 1.39 → 2.58, DD -3064 → -1134 (63% reduction).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 01:59:54 +07:00
romysaputrasihananda 9157c0d4f6 feat(backtest): ATR quality filter, pre-fill invalidation, entry zone config
Backtest improvements (XAUUSDm 20k candles vs baseline PF 1.12):
- ATR filter: FVG zone >= 0.3× ATR(14), impulse body >= 1.0× ATR(14) → PF 1.29, DD -3358
- Pre-fill invalidation: cancel pending FVG if price closes past impulse SL → PF 1.17
- ATR + pre-fill combined: PF 1.32, lowest DD -3230 (best overall)
- Entry zone config (ENTRY_ZONE_PCT): 0.0 aggressive / 0.5 midpoint / 1.0 conservative
  - Aggressive (0.0) hurts severely (PF 0.84), conservative (1.0) raises WR to 52.8%

New env vars: MIN_FVG_ATR_RATIO, MIN_IMPULSE_ATR_RATIO, PRE_FILL_INVALIDATE, ENTRY_ZONE_PCT
Rolling ATR(14) added to helpers using Wilder's RMA smoothing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 01:44:58 +07:00
romysaputrasihananda 272fca4f65 feat: session filter, breakeven SL, daily loss limit, startup alert, multi-pair web
Bot improvements:
- Session filter (SESSION_FROM_UTC/TO_UTC) — backtest confirms 08-13 UTC optimal for XAU
- Breakeven SL management (BREAKEVEN_AT_RR) — disabled by default, hurts XAU momentum
- Daily loss limit circuit breaker (DAILY_LOSS_LIMIT_PCT)
- Telegram startup alert with symbol, session, risk, and balance
- MT5 modify_position (TRADE_ACTION_SLTP) support in mt5-client

Web updates:
- Version badge auto-fetched from GitHub Releases API
- GitHub icon link in Nav and footer
- Multi-pair general (not XAUUSDm-specific)
- BTCUSDm backtest results added, session params in params table
- Trades page uses rolling 90-day window instead of hardcoded date

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v1.3.0
2026-06-12 00:48:45 +07:00
romysaputrasihananda dbba172ed3 chore(web): update SITE_URL to ares.romys.my.id
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 16:50:30 +07:00
romysaputrasihananda 7b44346f68 chore(web): add Google Search Console verification meta tag
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 16:45:40 +07:00
romysaputrasihananda daabb65f30 feat(web): ARES logo SVG + full SEO (metadata, sitemap, robots, favicon, per-page titles)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 16:30:05 +07:00
romysaputrasihananda 6cd8959c2d fix(web/trades): fetch deals per-day to bypass MT5 bridge per-request limit
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 16:26:18 +07:00
romysaputrasihananda 36037d7b2b fix(web/trades): use 2026-06-01 as deals date_from to avoid bridge response limit
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 16:18:09 +07:00
romysaputrasihananda 3cec0feefb feat(web/trades): P&L chart with 1D/7D/30D/ALL period selector + green/red zero-crossing color
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 16:10:05 +07:00
romysaputrasihananda 179b0ee055 feat(web/trades): force-dynamic + auto-refresh every 30s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 15:55:45 +07:00
romysaputrasihananda 5bf0386cd4 fix(web): send X-API-Key header to MT5 bridge for Cloudflare WAF bypass
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 15:16:19 +07:00
romysaputrasihananda 9716fc0955 feat(web): add Next.js portfolio with live MT5 dashboard
- Linear design system (dark canvas, lavender accent)
- Live account stats, open positions, pending orders (30s polling)
- Trade history with equity curve chart
- Backtest results table
- Proxy API routes — MT5_BASE_URL server-side only, never exposed to browser
- Deploy on Vercel: set MT5_BASE_URL env var

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 14:51:55 +07:00
romysaputrasihananda 4fdc3da4ed feat: improve Telegram message formatting
- Consistent header: icon + bold status + symbol · side
- Prices wrapped in <code> for monospace rendering
- TP/SL shown on separate lines (Entry/TP/SL aligned)
- Closed trades: entry → exit with vol + balance on one line
- PnL summary: trades · wins/losses · WR% with bold net P&L
- Add fp() helper for f64 price without trailing zeros

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v1.2.0
2026-06-11 02:11:27 +07:00
romysaputrasihananda 954cf6b8cf revert: remove chart generation (plotters approach dropped)
Chart image via plotters looked bad and TradingView webhook
can't send chart screenshots programmatically. Reverted to
text-only Telegram notifications.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 02:04:53 +07:00
romysaputrasihananda e285ab3ee0 feat: Telegram notifications for all 6 SSE events + hourly PnL summary
- Handle position_opened/closed/modified and order_placed/cancelled/modified
- Unified SsePayload struct (Option fields) for both position and order events
- Hourly PnL summary task (send_pnl_summary every 3600s, skip first tick)
- Add sim binary for testing TG notification flow without MT5
- Export telegram + helpers via lib.rs for bin access
- Update README with Telegram setup and event table
- Update .env.example with Telegram comment block

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 01:52:53 +07:00
romysaputrasihananda a49aee6ae0 feat: Telegram notifications + SSE position stream + PnL summary
- Add telegram.rs: send/edit messages via Bot API
- Add SSE position listener: position_opened → edit "Filled",
  position_closed → edit TP/SL result + send daily+alltime PnL summary
- Extend State with tg_message_id and trade details for notifications
- Add PosState to persist position info across SSE events
- Add Deal domain type and history_deals() client method
- New env: TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID, TELEGRAM_THREAD_ID

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v1.1.0
2026-06-11 01:28:45 +07:00
romysaputrasihananda 0583b6d0fb fix(client): send required dummy fields in cancel() for bridge compat
Bridge schema requires volume/type/price even for TRADE_ACTION_REMOVE.
MT5 ignores these fields when action=8; send minimal valid values.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v1.0.1
2026-06-10 18:25:27 +07:00
romysaputrasihananda 7d094591b8 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>
v1.0.0
2026-06-10 13:31:53 +07:00
romysaputrasihananda ddd8c98af5 feat: add margin call / stop-out simulation
STOP_OUT_PCT env var (default 0.0 = Exness standard: stop at $0 equity).
- During open trade: checks worst-case equity (candle.low/high) each candle
- Before new trade: checks balance > stop_out_balance
- Prints STOP-OUT event in trade log and MARGIN CALL banner in summary

Portfolio simulator updated: checks combined balance vs stop-out level.

Findings:
  1% risk — never margin-called at any stop-out level
  5% XAUUSDm — MARGIN CALL at STOP_OUT_PCT=0.2 (balance hit $88.99 < $120)
  5% XAGUSDm/BTC/Oil — survive 20% stop-out (lower early drawdown)
  Portfolio 4 pairs — no margin call at 20% stop-out (diversification)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 20:24:56 +07:00
romysaputrasihananda e85f5a4322 feat: optimize params with 99k candles from new bridge (10.1.34.194:8000)
BODY_PCT_MIN 0.60→0.50: PF 1.43→1.47 on XAUUSDm over 18 months
18-month window (Jan 2025-Jun 2026) vs 8.5 months previously

Best pairs (body=0.50, EMA=20, RR=1.5):
  XAUUSDm  PF=1.47  Return=+21606%  MaxDD=-$9131
  XAGUSDm  PF=1.63  Return=+496%    MaxDD=-$192   ← best risk-adjusted
  BTCUSDm  PF=1.25  Return=+2333%
  USOILm   PF=1.32  Return=+762%

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 20:08:53 +07:00
romysaputrasihananda a78dd26cf0 feat: make ares self-contained workspace with bundled domain/mt5-client crates
Vendor domain and mt5-client from hermes into crates/ so the repo can
be pushed to GitHub without external path dependencies.

Also includes all bug fixes from autonomous session:
- impulse SL fix (SL at impulse candle low/high, not zone edge)
- pip_size fix for 5-decimal pairs
- fill_ok premature cancellation fix
- TIMEOUT_CANDLES, MIN_FVG_PIPS, MIN_SL_PIPS env vars

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 20:03:09 +07:00
romysaputrasihananda e0e421ed05 feat: initial Ares scalping bot — momentum FVG strategy
Strategy: detect 3-candle momentum FVG on M5, enter on retrace fill.

Signal logic:
- Candle[i-1] must be a momentum candle: body ≥ BODY_PCT_MIN (default 60%)
  and close in top/bottom CLOSE_PCT_MIN (default 80%) of range
- FVG must exist between candle[i-2] and candle[i] (gap on momentum side)
- FVG zone midpoint = limit entry level
- SL: just outside FVG zone (+ optional SL_BUFFER)
- TP: entry ± SL_distance × MIN_RR

Features:
- EMA trend filter (EMA_PERIOD, same timeframe)
- FVG expiry (FVG_EXPIRY_CANDLES): stale setups auto-invalidate
- Currency conversion for non-USD profit pairs (JPY, CAD, CHF)
- Full friction model: spread, slippage, commission
- Date range filter (DATE_FROM / DATE_TO)
- Same stats output format as Hermes

Dependencies: domain + mt5-client from hermes/crates (path deps)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 04:01:40 +07:00