Harden safety & correctness (EA + bridge) + compile CI#1
Merged
Conversation
EA (bulk-add-signals.mq5): - Reject wrong-side order types instead of silently converting STOP<->LIMIT, which used to reverse trade intent (breakout vs pullback). Support all four pending types explicitly and validate SL/TP are on the correct side. - Store the actual TP prices per group and use them for trailing SL (real TP1) and safe shutdown (real TP2) instead of hardcoded pip offsets that broke on any non-default TP ladder. Fixes the converted-LIMIT direction bug. - Use a compact "<groupId>#<idx>" order comment so group/TP tokens survive broker comment truncation; rebuild TP prices from live orders on recovery and accept both the new and legacy comment formats. - Reset the daily-loss baseline at each day boundary and measure against equity so floating losses count. Bridge (server.py): - Give each request its own response Event so concurrent calls can no longer receive each other's response; abandon a command on timeout so it can't fire late on the EA's next poll. - Add optional X-API-Key auth and bind to 127.0.0.1 by default; Docker sets HOST=0.0.0.0 with an API_KEY passthrough and no longer runs uvicorn --reload. Docs updated where behavior changed (no auto-convert; TP-aware trailing; new Security section). Verified: EA compiles with MetaEditor (0 errors, 0 warnings); bridge correlation + timeout-abandon covered by a local test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds a GitHub Actions workflow (Windows runner) that installs MetaTrader 5, unpacks the MQL5 standard library, and compiles bulk-add-signals.mq5, failing the job on any compile error and uploading the .ex5 artifact on success. Adds a build-status badge to the README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The .mq5 was UTF-8 without a BOM and used emoji in Print() logs. MetaEditor treats a no-BOM source as ANSI, so on a fresh Windows install (the CI runner) each emoji corrupted its string literal -> 101 compile errors, even though a UTF-8-locale build (local Wine) compiled it cleanly. Replaced the emoji with short ASCII tags ([OK], [ERR], [WARN], ...) so the source compiles identically regardless of the compiler's codepage. Logs only; no behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…lback) The installer writes files in stages, so waiting only for MetaEditor64.exe raced ahead of terminal64.exe and the "unpack" step crashed with file-not- found. Merge install+unpack into one step that waits for the header the compile actually needs (Include\Trade\Trade.mqh), and only launches the terminal as a guarded fallback if the installer didn't lay it down. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Root cause of the 101 errors: MetaEditor resolved <Trade/Trade.mqh> from its roaming data directory (empty), not the Program Files install dir where the standard library lives, so every include failed and cascaded into undeclared CTrade/CPositionInfo/CAccountInfo errors. Compiling with /portable points MetaEditor at the install-dir MQL5 tree. (The earlier emoji were never the cause - same 101 errors before and after the ASCII change.) Co-Authored-By: Claude Opus 4.8 <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.
Safety/correctness hardening for the EA and Python bridge, plus a GitHub Actions workflow that compiles the EA on every push/PR.
Verified: EA compiles with MetaEditor (0 errors, 0 warnings); bridge correlation + timeout-abandon covered by a local test.
EA (
bulk-add-signals.mq5)<groupId>#<idx>comment, TP prices rebuilt from live orders, both new and legacy formats parsed.Bridge (
server.py)X-API-Keyauth; binds to 127.0.0.1 by default; Docker sets HOST=0.0.0.0 + API_KEY and drops--reload.CI
.github/workflows/compile-ea.ymlcompiles the EA on a Windows runner and fails on any error.Generated with Claude Code