Mt4 Trader
MT4 Trader Bridge enables Python to MT4 EA communication via files for trading, order management, risk control, and grid strategies without extra dependencies. Skill: Mt4 Trader Owner: apuba Summary: MT4 Trader Bridge enables Python to MT4 EA communication via files for trading, order management, risk control, and grid strategies without extra dependencies. Tags: automated-trading:1.0.7, forex:1.0.7, grid:1.0.7, latest:1.2.1, mt4:1.0.7, python:1.0.7, trading:1.0.7 Version history: v1.2.1 | 2026-05-12T17:46:26.544Z | user v1.86: restore full SKILL.md v1.2.0 | 2026-05-12T15:5
Rank
62
Safety
84
Downloads
1.2k
Updated
Oct 11, 2026
Version
1.2.1
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/11/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 11, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 11, 2026
- Adoption signal
- 1.2K downloadsadoption · observed Oct 11, 2026
- Latest release
- 1.2.1release · observed May 12, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s170awvgg1xj09qps70x185k9h863qvh:mt4-trader- Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-apuba-mt4-trader/snapshot"
Documentation
CLAWHUB
147,059 characters of source documentation, loaded on request.
Extracted files
4 files captured from the source.
SKILL.md
# MT4 智能交易桥 · 量化自动交易系统
MT4 智能交易桥。通过文件 I/O 与 MT4 EA 通信,无需 DLL 或额外依赖。支持 OpenClaw(小龙虾 AI Agent)通过微信 / 飞书 / Telegram 等渠道直接操作 MT4 交易。
> **关键词**:MT4, MetaTrader 4, 外汇交易, Python交易, 算法交易, 自动交易, 网格策略, 支撑压力位, ATR止损, 移动止损, 黄金交易, 原油交易, 比特币交易, OpenClaw, 小龙虾, AI交易助手, 微信操作MT4, 飞书操作MT4
## 🎯 自然语言交互示例
### 📱 微信/飞书/Telegram 口语化命令
| 你说 | MT4 做 |
|-----|--------|
| 黄金多少钱 | 返回 XAUUSD.s 实时报价 |
| 买黄金 0.05 手 | 市价买入 0.05 手 |
| 平仓 95832104 | 平掉指定订单 |
| 全平 | 平掉所有持仓 |
| 查持仓 | 列出当前所有持仓 |
| 设置止损 95832104 4500 | 设置止损位 |
| 启动黄金网格 | 启动黄金网格策略 |
| 获取MT4 黄金的1小时K线数据进行行情分析 | 将会自动帮您分析好黄金后市走向以及给出交易方案 |
---
## 文件结构
```
mt4-trader/
├── SKILL.md # 本使用说明
├── mql4/ # MT4 EA 编译文件(.ex4,由脚本生成)
│ [用户手动下载 .ex4 文件放到此目录]
├── scripts/ # Python 脚本
│ ├── mt4_client.py # Python 交易客户端(核心)
│ ├── deploy_ex4.py # EA 部署指引(显示下载链接和安装步骤)
│ ├── alert_commands.py # 价格预警命令行工具
│ ├── position_summary.py # 持仓汇总(命令行输出)
│ ├── position_summary_cron.py # 持仓汇总(定时推送)
│ ├── sr_strategy.py # 支撑压力位策略编排
│ └── summary_utils.py # 持仓汇总工具模块
└── references/
└── api_docs.md # 完整 API 参考文档
```
---
## 安装步骤(详细版)
### 第一步:找到你的 MT4 数据目录
每个 MT4 安装实例都有一个专属的数据目录,格式为:
```
%APPDATA%\MetaQuotes\Terminal\<32位随机ID>
```
例如:`C:\Users\Administrator\AppData\Roaming\MetaQuotes\Terminal\ABC123...`
> 怎么找?在 MT4 中按 `F7` 打开 MetaEditor(代码编辑器),点击菜单 `文件 → 打开数据文件夹`,弹出的路径就是你的 MT4 数据目录。
### 第二步:确认 MT4 安装目录
EA 文件需要部署到两个不同的目录:
| EA 文件 | 目标目录 | 说明 |
|---------|---------|------|
| `mt4_bridge.ex4` | `MT4安装目录\MQL4\Experts\` | 主程序 EA(必须) |
| `芝麻网格V2.ex4` | `MT4安装目录\MQL4\Experts\` | 网格策略 EA(可选) |
| `tools2.3.ex4` | `MT4安装目录\MQL4\Libraries\` | **网格策略依赖库**(网格必须,不是 Experts!) |
> ⚠️ `Libraries` 目录与 `Experts`、`Indicators` 同级,**不是** `Experts` 的子目录。
典型路径结构:
```
C:\Program Files (x86)\EBC Financial Group Cayman MT4 Terminal\MQL4\
├── Experts\ ← mt4_bridge.ex4, 芝麻网格V2.ex4 放这里
│ ├── mt4_bridge.ex4
│ └── 芝麻网格V2.ex4
├── Libraries\ ← tools2.3.ex4 放这里(与 Experts 同级!)
│ └── tools2.3.ex4
├── Indicators\
└── Scripts\
```
### 第三步:下载 .ex4 文件
从 Gitee 仓库下载 3 个 .ex4 文件:
https://gitee.com/3603317/skill-plugin/tree/master/mt4
需要下载的文件:
| 文件 | 说明 |
|------|------|
| `mt4_bridge.ex4` | 主程序 EA(**必选**) |
| `芝麻网格V2.ex4` | 网格策略 EA(可选) |
| `tools2.3.ex4` | 网格策略依赖库(选网格则必选) |
> 点击文件 → 点右上角 **Raw** 按钮即可保存到本地。
下载后放入 skills\mt4-trader\mql4\ 目录,然后运行以下命令一键部署到 MT4:
```bash
cd scripts\
python deploy_ex4.py deploy
```
### 第四步:在 MT4 中挂载 EA
**挂载 mt4_bridge(核心,必须操作):**
1. 打开 MT4,按 `Ctrl+N` 打开左侧"导航器"面板
2. 展开"EA 交易"列表,找到 `mt4_bridge`
3. 用鼠标左键拖拽到任意品种图表上(推荐 XAUUSD.s 或主流品种)
4. 弹出 EA 属性对话框 → **选项卡"常用"**:
- **允许实时交易** → ✅ 勾选(必须!)
- **允许导入 DLL** → ✅ 勾选
- **确认取消"手动交易禁止"** 等限制
5. 点"确定"关闭对话框
6. 图表右上角显示一个 EA 图标:
- 😊 **绿色笑脸** → ✅ 正常工作中
- 😢 哭脸或灰_meta.json
{
"ownerId": "kn723gzdjbmh391jks7n35xdf982v5y7",
"slug": "mt4-trader",
"version": "1.2.1",
"publishedAt": 1778607986544
}references/api_docs.md
# MT4 Bridge API Reference ## Symbols: XAUUSD.s (Gold), BTCUSD, XAGUSD, XTIUSD.s ## Methods ### Trading buy(symbol, lots), sell(symbol, lots), close_all(symbol), close_by_magic(symbol, magic) ### Pending Orders buy_limit(symbol, lots, price), sell_limit(symbol, lots, price), buy_stop(symbol, lots, price), sell_stop(symbol, lots, price), cancel_order(ticket) ### SL/TP set_sl(symbol, ticket, price), set_tp(symbol, ticket, price), modify_order(symbol, ticket, price, sl, tp) ### Grid (Sesame EA) grid_start(symbol, direction), grid_stop(symbol), grid_close_all(symbol), grid_status(symbol), grid_set_sl_tp(symbol) ### Chart Objects (v1.86) draw_sr_levels(symbol, timeframe), clear_chart_objects(symbol), draw_hline(symbol, name, price), clear_hline(symbol, prefix) ### Data add_alert(symbol, price, tip), get_klines(symbol, timeframe, count), get_positions(symbol), get_notifications(symbol)
skill-card.md
## Description: MT4 Trader Bridge enables Python-to-MetaTrader 4 expert-advisor communication through local JSON files for market data, trading, order management, risk controls, alerts, and grid strategies. This skill is ready for commercial/non-commercial use. ## Publisher: [apuba](https://clawhub.ai/user/apuba) ### License/Terms of Use: MIT-0 ## Use Case: Developers and trading-automation operators use this skill to connect an agent or Python scripts to MT4 for quotes, position review, order placement, stop-loss/take-profit changes, alerts, summaries, and grid strategy control. ### Deployment Geography for Use: Global ## Known Risks and Mitigations: Risk: The skill asks users to install unverified MT4 .ex4 expert-advisor binaries that can affect trading accounts. Mitigation: Use only a demo or tightly limited account unless the binaries are independently trusted and verified; pin and hash-check any downloaded .ex4 files. Risk: The bridge exposes high-impact live trading actions, including order placement, bulk close, stop changes, and grid strategy controls. Mitigation: Require explicit confirmation for every trade or bulk-close action and do not enable live trading for unverified files. Risk: The file-based bridge directory and summary webhook can be abused if untrusted local processes or endpoints are allowed. Mitigation: Restrict the bridge directory to trusted local processes and use only HTTPS allowlisted webhook endpoints for summaries. Risk: The artifact instructs users to enable DLL imports for MT4 expert advisors. Mitigation: Do not enable DLL imports for unverified files. ## Reference(s): - [MT4 Bridge API Reference](artifact/references/api_docs.md) - [ClawHub Skill Page](https://clawhub.ai/apuba/skills/mt4-trader) - [Gitee MT4 Download Page](https://gitee.com/3603317/skill-plugin/tree/master/mt4) ## Skill Output: **Output Type(s):** [Text, Markdown, Code, Shell commands, Configuration, Guidance] **Output Format:** [Markdown guidance with Python and shell command examples] **Output Parameters:** [1D] **Other Properties Related to Output:** [May produce local JSON bridge requests, position summaries, alert configurations, and webhook message payloads when scripts are run.] ## Skill Version(s): 1.2.1 (source: server-resolved release metadata) ## Ethical Considerations: Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/apuba/skills/mt4-trader",
"sourceUrl": "https://clawhub.ai/apuba/skills/mt4-trader",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T00:21:25.734Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-apuba-mt4-trader/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-apuba-mt4-trader/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-11T00:21:25.734Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.2K downloads",
"href": "https://clawhub.ai/apuba/mt4-trader",
"sourceUrl": "https://clawhub.ai/apuba/mt4-trader",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T00:21:25.734Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "1.2.1",
"href": "https://clawhub.ai/apuba/mt4-trader",
"sourceUrl": "https://clawhub.ai/apuba/mt4-trader",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-05-12T17:46:26.544Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-apuba-mt4-trader/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-apuba-mt4-trader/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 1.2.1",
"description": "v1.86: restore full SKILL.md",
"href": "https://clawhub.ai/apuba/mt4-trader",
"sourceUrl": "https://clawhub.ai/apuba/mt4-trader",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-05-12T17:46:26.544Z",
"isPublic": true
}
]
}Record generated Oct 11, 2026.
