Variable 1-10 splits, any-symbol support, MCP server, tests + Python CI#2
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the approved design in docs/superpowers/specs/2026-07-04-expansion-design.md.
What's new
tp_levelsaccepts 1-10 levels; optionalvolume_splitwith full validation; legacy 5-level clients get identical behavior (default 60/10/10/10/10).MT5_MCP_ENABLE_TRADING=1.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
🤖 Generated with Claude Code