Skip to content

feat(chartctl): Chart Deployments — remote EA deployment over HTTP - #10

Draft
Marinski wants to merge 1 commit into
psyb0t:masterfrom
Marinski:feature/chart-deployments
Draft

feat(chartctl): Chart Deployments — remote EA deployment over HTTP#10
Marinski wants to merge 1 commit into
psyb0t:masterfrom
Marinski:feature/chart-deployments

Conversation

@Marinski

@Marinski Marinski commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Chart Deployments (chartctl)

Chart Deployments (chartctl) lets you attach Expert Advisors to charts with .set files over the HTTP API — no RDP, no terminal restart, and no manual chart work.

The API stores the desired state, while a resident Loader EA inside the terminal reconciles charts to match that state and reports the observed state back. A deployment only reaches the running state after the Loader confirms the Expert Advisor is actually live on a chart.

New Endpoints

Method Endpoint Description
POST / GET / DELETE /experts, /experts/<hash> Stage, list, or remove EA .ex5 files
POST / GET /sets, /sets/<name> Stage, list, or inspect .set files (returns parsed inputs)
POST / GET /deployments Create or list deployments
GET / PATCH / DELETE /deployments/<id> Inspect, pause/resume, change set, or delete a deployment
POST /deployments/reconcile Force an immediate reconcile
GET /charts Live chart / EA inventory
GET /loader Loader EA status and version
POST /charts/<id>/screenshot Capture a chart as PNG
POST /charts/<id>/close Close any chart by ID
GET / PUT /webrequest Read or update the WebRequest allowlist
POST /webrequest/apply Re-apply the allowlist immediately

What's Included

  • mt5api/chartctl/ — paths, setparse, tpl_builder, registry, command
  • mt5api/handlers/chartctl.py — lock-free REST surface, gated by CHARTCTL_ENABLED (config-driven; routes are omitted when disabled)
  • mt5api/handlers/webrequest.py — WebRequest allowlist provisioning
  • mt5api/chartctl/autoit_webrequest.py — AutoIt GUI automation
  • assets/experts/MT5ChartLoader.mq5 — reference Loader EA (~60 lines)
  • assets/experts/include/ChartControl.mqh — portable protocol include
  • assets/autoit/ — AutoIt interpreter and GUI automation scripts
  • scripts/compile-chartctl-loader.bat — zero-touch bootstrap compiler
  • scripts/config_helper.pywrite_ini emits [StartUp] Expert= and provides the chartctl_enabled query command
  • docs/chart-control-protocol.md — complete protocol specification
  • tests/test_chartctl_units.py + tests/test_chartctl_endpoints.py — 43 tests plus a Python fake_loader for Linux CI (no MT5 dependency)
  • tests/test_webrequest.py — 23 tests covering the allowlist codec and endpoints
  • examples/chartctl/deploy.sh — runnable deployment example

Zero-Touch Bootstrap

No RDP step is required.

On VM boot:

  1. compile-chartctl-loader.bat compiles the Loader in every broker base using MetaEditor64.
  2. The resulting .ex5 is propagated to every terminal instance.
  3. config_helper.py write_ini adds a [StartUp] section to mt5start.ini.

The Loader automatically attaches when the terminal starts.

To disable this behavior for a specific terminal, set:

chartctl: false

How It Works

The Loader polls desired.json, reconciles the desired state with actual charts, writes observed.json so the API knows what is actually running. All handler endpoints are lock-free and perform only file I/O.

WebRequest Allowlist

Two application methods selected automatically at runtime: AutoIt GUI automation (Windows VM) or common.ini encoding (Bare Metal).

Changelog

See the CHANGELOG.md Unreleased section for the complete list of changes.

Testing

pytest tests/ --ignore=tests/integration --ignore=tests/test_requirements_sync.py
→ 284 passed
  • 43 chartctl tests
  • 23 webrequest tests
  • 218 existing tests

Attach Expert Advisors to charts with .set files over the HTTP API — no RDP,
no terminal restart, no manual chart work. The API stores the desired state
and a resident Loader EA inside the terminal reconciles charts to match,
reporting the observed state back; a deployment only reaches `running` after
the Loader confirms the EA is live on a chart.

New endpoints (gated by `chartctl.enabled`, routes omitted when disabled):
- `/experts`, `/experts/<hash>` — stage, list, remove EA .ex5 files
- `/sets`, `/sets/<name>` — stage, list, inspect .set files (parsed inputs)
- `/deployments`, `/deployments/<id>` — create, list, inspect, pause/resume,
  change set, delete
- `/deployments/reconcile` — force an immediate reconcile
- `/charts`, `/charts/<id>/screenshot`, `/charts/<id>/close` — live inventory
  and chart control
- `/loader` — Loader EA status and version
- `/webrequest`, `/webrequest/apply` — WebRequest allowlist provisioning

Includes:
- `mt5api/chartctl/` — paths, setparse, tpl_builder, registry, command
- `mt5api/handlers/chartctl.py` + `webrequest.py` — lock-free REST surface
- `mt5api/chartctl/autoit_webrequest.py` — AutoIt GUI automation; two runtime
  paths chosen automatically (AutoIt on the Windows VM, common.ini encoding on
  bare metal)
- `assets/experts/MT5ChartLoader.mq5` + `include/ChartControl.mqh` — reference
  Loader EA (~60 lines) and portable protocol include
- `assets/autoit/` — AutoIt interpreter and GUI automation scripts
- `scripts/compile-chartctl-loader.bat` — zero-touch bootstrap compiler; on
  boot it compiles the Loader in every broker base, propagates the .ex5 to
  every terminal instance, and `config_helper.py write_ini` adds `[StartUp]
  Expert=` so the Loader auto-attaches. Disable per terminal with
  `chartctl: false`.
- `scripts/webrequest_allowlist_codec.py` — allowlist codec
- `docs/chart-control-protocol.md` — full protocol specification
- `examples/chartctl/deploy.sh` — runnable deployment example
- Tests: 43 chartctl tests (units + endpoints, with a Python fake_loader for
  Linux CI, no MT5 dependency) plus 35 WebRequest tests

Rebased on current master; single commit.
@Marinski
Marinski force-pushed the feature/chart-deployments branch from 90905af to a960a7d Compare August 5, 2026 10:49
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