a584f46891
Demo + assets
- Synthetic backtests now occasionally fail (regime failures, OOS degradation)
so verdicts span RECOMMENDED / RISKY / NOT_RELIABLE realistically. Phase 1
has ~35% failure rate, Phase 2 AI loop ~10%, OOS has 30% chance of severe
degradation — matches what real markets look like
- screenshots/dashboard.png + best_result_modal.png regenerated against the
current UI; screenshots/apex_demo.gif (6-frame autonomous-run timelapse)
embedded in the README
FEATURE 1 — Live AI token streaming
- AIReasoner._call_claude() now streams via SSE when a callback is
registered. Each text delta forwards to the dashboard as
`ai_thinking_chunk` events
- The Live AI Thinking Feed renders a single growing bubble with a blinking
cursor while text streams in, finalising on `end`. Looks and feels like
watching the AI type
FEATURE 2 — Pre-flight check on /setup
- New /api/preflight endpoint runs 5–7 probes: config readable, API key
set, MT5 paths exist (skipped in demo), EA registered, reports folder
writable. Returns {ok, blocking_count, checks[]}
- Setup page renders a colour-coded checklist on load and refocus.
Replaces "click Start, wait 5s, see generic error"
FEATURE 3 — Hot-reload settings into the running pipeline
- pipeline.reload_config() applies AI model / timeout / API-key swaps to
the live reasoner mid-run. Threshold changes surface for next run
- /api/settings POST detects a running pipeline and calls reload_config(),
returning the changed keys plus a "hot-reloaded into the running
optimization" note
FEATURE 4 — Replay scrubber on Best Result
- Evolution path now renders as an interactive scrubber: range slider +
prev/next/play buttons. Each step shows the run ID, phase, score, full
metrics grid, parameter changes for that step, and the AI's analysis
text — auto-plays at 700ms/step
FEATURE 5 — Compare runs on /reports
- Each card has a checkbox; selecting 2–4 reveals a floating Compare bar.
Compare modal renders a side-by-side table with metric winners
highlighted (Calmar / PF / profit favour higher; DD favours lower)
and a parameter-diff section showing changed values
FEATURE 6 — Discord / Slack / generic webhook on completion
- New `notifications.webhook_url` + `webhook_style` config keys
- Auto-detects Discord vs Slack from the URL host. Posts a one-line
summary on `optimization_complete`: verdict + best run + PF/Calmar/DD/
profit/trades/elapsed
133 lines
4.9 KiB
YAML
133 lines
4.9 KiB
YAML
# ── APEX MT5 Optimizer — example config ─────────────────────────────────────
|
|
# Copy this file to `config.yaml` and fill in your values. config.yaml is
|
|
# git-ignored so your secrets stay local.
|
|
#
|
|
# cp config.example.yaml config.yaml
|
|
#
|
|
# Or set ANTHROPIC_API_KEY as an environment variable and the app will pick it
|
|
# up automatically (overrides whatever is in config.yaml).
|
|
|
|
ai:
|
|
enabled: true
|
|
# Get your key from https://console.anthropic.com/
|
|
# Leave as-is to use the ANTHROPIC_API_KEY environment variable.
|
|
anthropic_api_key: ${ANTHROPIC_API_KEY}
|
|
model: claude-opus-4-7 # claude-opus-4-7 | claude-sonnet-4-6 | claude-haiku-4-5
|
|
timeout_seconds: 45
|
|
analyze_every_n_iterations: 1
|
|
|
|
# ── Strategy thresholds — quality gates a result must clear ────────────────
|
|
thresholds:
|
|
min_trades: 50
|
|
min_profit_factor: 1.2
|
|
min_calmar: 0.35
|
|
min_wfv_ratio: 0.7
|
|
max_oos_degradation: 0.3
|
|
sensitivity_tolerance: 0.3
|
|
|
|
# ── Scoring weights — how the ranker combines metrics ──────────────────────
|
|
scoring:
|
|
significance_trades: 150
|
|
weights:
|
|
calmar: 0.35
|
|
profit_factor: 0.20
|
|
mfe_capture: 0.20
|
|
session_stability: 0.15
|
|
recovery_factor: 0.10
|
|
normalization:
|
|
calmar: { lo: 0.0, hi: 4.0 }
|
|
profit_factor: { lo: 1.0, hi: 3.5 }
|
|
recovery_factor: { lo: 0.0, hi: 6.0 }
|
|
mfe_capture: { lo: 0.0, hi: 1.0 }
|
|
session_stability: { lo: 0.0, hi: 1.0 }
|
|
|
|
# ── Broker / market context ────────────────────────────────────────────────
|
|
broker:
|
|
currency: USD
|
|
deposit: 10000
|
|
leverage: 100
|
|
timezone_offset_hours: 2
|
|
sessions:
|
|
Asian: { start: 0, end: 9 }
|
|
London: { start: 9, end: 18 }
|
|
LondonNY: { start: 15, end: 18 }
|
|
NY: { start: 15, end: 24 }
|
|
|
|
# ── EA selection (auto-populated when you register an EA in /setup) ────────
|
|
ea:
|
|
name: LEGSTECH_EA_V2
|
|
file: LEGSTECH_EA_V2
|
|
symbol: XAUUSD
|
|
timeframe: H1
|
|
|
|
# ── MetaTrader 5 paths ─────────────────────────────────────────────────────
|
|
# Adjust these to match your local MT5 installation.
|
|
mt5:
|
|
terminal_exe: C:/Program Files/MetaTrader 5/terminal64.exe
|
|
appdata_path: C:/Users/<YOU>/AppData/Roaming/MetaQuotes/Terminal/<HASH>
|
|
mql5_files_path: C:/Users/<YOU>/AppData/Roaming/MetaQuotes/Tester/<HASH>/Agent-127.0.0.1-3000/MQL5/Files
|
|
report_subdir: runs
|
|
tester_model: 4 # 1=Every tick, 2=Real ticks, 3=OHLC, 4=Open prices
|
|
tester_timeout_seconds: 1800
|
|
data_readiness_wait_seconds: 10
|
|
kill_on_start: true
|
|
shutdown_terminal: 1
|
|
|
|
# ── Backtest periods ───────────────────────────────────────────────────────
|
|
periods:
|
|
train_start: 2022.01.01
|
|
train_end: 2023.12.31
|
|
validate_start: 2024.01.01
|
|
validate_end: 2024.06.30
|
|
oos_start: 2024.07.01
|
|
oos_end: 2024.12.31
|
|
|
|
# ── Optimization tuning ────────────────────────────────────────────────────
|
|
optimization:
|
|
max_iterations: 50
|
|
convergence_threshold: 0.04
|
|
convergence_window: 3
|
|
|
|
mutation:
|
|
max_hypotheses_per_cycle: 3
|
|
dedup_lookback_runs: 10
|
|
explore_fallback_after: 5
|
|
|
|
analysis:
|
|
equity_curve:
|
|
min_r_squared: 0.7
|
|
max_flatness_score: 0.5
|
|
reversal:
|
|
mfe_threshold_pips: 15.0
|
|
min_reversal_rate: 0.15
|
|
permutation_n: 500
|
|
time_performance:
|
|
min_trades_per_bucket: 10
|
|
permutation_n: 1000
|
|
z_score_threshold: -1.5
|
|
entry_exit:
|
|
poor_entry_quality: 0.4
|
|
poor_exit_quality: 0.55
|
|
|
|
# ── Paths ──────────────────────────────────────────────────────────────────
|
|
paths:
|
|
db: optimizer.db
|
|
reports_dir: reports
|
|
runs_dir: runs
|
|
ea_registry: ea_registry.yaml
|
|
log_file: optimizer.log
|
|
|
|
logging:
|
|
level: INFO
|
|
file: optimizer.log
|
|
|
|
# ── Notifications (optional) ───────────────────────────────────────────────
|
|
# When set, APEX POSTs a JSON summary to this URL when an optimization
|
|
# completes — works with Discord webhooks, Slack incoming webhooks, or any
|
|
# endpoint that accepts JSON. Leave empty to disable.
|
|
notifications:
|
|
webhook_url: ""
|
|
# Style preset that shapes the JSON body. Auto-detected from URL host if
|
|
# left as 'auto'. Options: auto | discord | slack | generic
|
|
webhook_style: auto
|