Skip to content

Variable 1-10 splits, any-symbol support, MCP server, tests + Python CI#2

Merged
codedpro merged 3 commits into
mainfrom
expand-splits-and-mcp
Jul 5, 2026
Merged

Variable 1-10 splits, any-symbol support, MCP server, tests + Python CI#2
codedpro merged 3 commits into
mainfrom
expand-splits-and-mcp

Conversation

@codedpro

@codedpro codedpro commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Implements the approved design in docs/superpowers/specs/2026-07-04-expansion-design.md.

What's new

  • Variable splits: tp_levels accepts 1-10 levels; optional volume_split with full validation; legacy 5-level clients get identical behavior (default 60/10/10/10/10).
  • Any-symbol support: volumes snap to the broker's lot step (min-lot rejection names the viable lot size); prices normalize to symbol digits. Gold/Silver are now examples, not limits.
  • MCP server: FastMCP stdio wrapper over the REST bridge. Read-only tools always on; trading tools gated behind MT5_MCP_ENABLE_TRADING=1.
  • Tests + CI: 12 pytest cases for the bridge (correlation, timeout-abandon, auth, validation matrix) + a Python CI workflow.

Latent bug fixed (pre-existing)

Trailing/cleanup logic treated "not an open position" as "closed" - but pending orders aren't positions, so a stop-order group's tracking self-destructed one tick after placement, silently disabling trailing and safe-shutdown for any group that didn't fill instantly (likely the root cause of the old "Trailing Stop Not Activating" FAQ). Liveness checks are now pending-order aware, cleanup no longer leaks tp2-reached groups, and trailing also runs from OnTimer for non-chart symbols.

Verification

  • MetaEditor compile: 0 errors, 0 warnings (local Wine /portable; CI recompiles on Windows)
  • Tests: 12/12 pass locally; CI reruns on 3.11 with pinned deps
  • MCP server imports verified in both gated modes
  • Review: 4 Opus coders + API/security review lenses (clean) + manual MQL5 review (found the liveness bug above)

Compile/unit verified only - demo-test before live use.

🤖 Generated with Claude Code

codedpro and others added 3 commits July 4, 2026 15:32
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- API: tp_levels accepts 1..10 levels; new optional volume_split (validated:
  matching length, entries >= 0, at least one > 0, sum ~1.0). Default split
  (N=1 -> 100%; else 60% TP1 + even remainder) reproduces the legacy
  60/10/10/10/10 for 5 levels, so existing clients are unchanged. v4.2.0.
- EA: MAX_SPLITS=10 fixed-capacity arrays + per-group count; volumes floor to
  the broker's SYMBOL_VOLUME_STEP with a clear rejection below SYMBOL_VOLUME_MIN;
  entry/SL/TPs normalize to SYMBOL_DIGITS (true any-symbol support); comment
  parser handles multi-digit level indices; volume_split entries of 0 skip a
  level.
- EA bugfix (latent, pre-existing): trailing/cleanup treated "not an open
  position" as "closed", but pending orders are not positions - so a stop-order
  group's tracking self-destructed one tick after placement, silently disabling
  trailing and safe-shutdown. Liveness is now pending-order aware
  (OrderSelect || PositionSelectByTicket), cleanup runs for all groups
  (tp2_reached groups previously leaked), and trailing also runs from OnTimer
  so non-chart symbols trail.
- MCP server (mcp_server.py): FastMCP stdio wrapper over the REST bridge;
  read-only tools always on; trading tools gated behind MT5_MCP_ENABLE_TRADING.
- Tests: 12 pytest cases (envelope correlation, timeout-abandon, waiting,
  auth, validation matrix) + ci-python.yml workflow; README documents all of it.

Verified: MetaEditor compile 0 errors/0 warnings (Wine /portable); 12/12 tests
pass; MCP imports in both gated modes. Runtime trading behavior still requires
demo-account testing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Float-sum assertion tolerated: Python 3.12+ sum() uses Neumaier summation
  (exactly 1.0) while CI's 3.11 naive-sums to 0.9999999999999999.
- Pin httpx<0.28 in requirements-dev: the pinned fastapi 0.109 TestClient
  passes app= to httpx.Client, removed in httpx 0.28.
- docs/ROADMAP.md: 19 audited items - known bugs (dead MaxSpreadPips, position
  cap ignores pending orders, unused partial_close_percent, server-time daily
  reset, comment-only state), promised features (configurable trailing, group
  API, Telegram, journal, dashboard, MCP group tools), and infra follow-ups.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codedpro codedpro merged commit 696644d into main Jul 5, 2026
3 checks passed
@codedpro codedpro deleted the expand-splits-and-mcp branch July 5, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant