Skip to content
Agentmart
Submit a tool

mql5

MQL5 development skill for MetaTrader 5 Expert Advisors, Indicators, Scripts, and Services.

Skill by ZhijuCen

IndexedMIT★ 2
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/zhijucen-mql5

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

MQL5 development skill for MetaTrader 5 Expert Advisors, Indicators, Scripts, and Services. Focus on positions, orders, indicators, ticks, bars, risk management, backtesting, and multi-instance MT5 operations. Includes programming book and API reference documentation.

Use cases: backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/mql5

What's inside

Skill name
mql5
Description
MQL5 development skill for MetaTrader 5 Expert Advisors, Indicators, Scripts, and Services. Focus on positions, orders, indicators, ticks, bars, risk management, backtesting, and multi-instance MT5 operations. Includes programming book and API reference documentation.
License
MIT
Compatibility
Target: MetaTrader 5 platform. Language: MQL5 (C++-like syntax). File extensions: *.mq5 (source), *.mqh (headers). Run time: Windows native, Linux via Wine, macOS via Wine.
Metadata
version: 0.1
Instructions
477 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (200)

  • SKILL.md
  • Anonymous.XAUUSD.M15.ini · assets/
  • calendar-events.csv · assets/
  • .gitignore · assets/mql5.com-artical-22196-MetaQuotes/
  • CalendarEventMonitor-EA.mq5 · assets/mql5.com-artical-22196-MetaQuotes/22196-attaches/
  • ExportCalendarForTester-S.mq5 · assets/mql5.com-artical-22196-MetaQuotes/22196-attaches/
  • FullLiveLog.txt · assets/mql5.com-artical-22196-MetaQuotes/22196-attaches/
  • GetTodayEvents-S.mq5 · assets/mql5.com-artical-22196-MetaQuotes/22196-attaches/
  • ImportCalendarValidation-EA.mq5 · assets/mql5.com-artical-22196-MetaQuotes/22196-attaches/
  • ImportTesterLog.txt · assets/mql5.com-artical-22196-MetaQuotes/22196-attaches/
  • README.md · assets/mql5.com-artical-22196-MetaQuotes/
  • ea-skeleton.mq5 · assets/templates/
  • position-manager.mqh · assets/templates/
  • risk-helpers.mqh · assets/templates/
  • 0001-intro.md · references/book/00-intro/
  • 0002-intro-edit-compile-run.md · references/book/00-intro/
  • 0003-intro-mql-wizard.md · references/book/00-intro/
  • 0004-intro-statement-blocks.md · references/book/00-intro/
  • 0005-intro-first-program.md · references/book/00-intro/
  • 0006-intro-types-and-values.md · references/book/00-intro/
  • 0007-intro-variables-and-identifiers.md · references/book/00-intro/
  • 0008-intro-init-assign-express.md · references/book/00-intro/
  • 0009-intro-data-input.md · references/book/00-intro/
  • 0010-intro-errors-debug.md · references/book/00-intro/
  • 0011-intro-a-data-output.md · references/book/00-intro/
  • 0012-intro-b-formatting.md · references/book/00-intro/
  • 0013-intro-c-summing-up.md · references/book/00-intro/
  • alert-ru.png · references/book/00-intro/pics/
  • comment.png · references/book/00-intro/pics/
  • goodtime1_en.png · references/book/00-intro/pics/
  • me_compile_en.png · references/book/00-intro/pics/
  • me_debug_en.png · references/book/00-intro/pics/
  • me_edit_en.png · references/book/00-intro/pics/
  • me_error_en.png · references/book/00-intro/pics/
  • mt_navex_en.png · references/book/00-intro/pics/
  • part1gog.png · references/book/00-intro/pics/
  • wizard_script_name_params_en.png · references/book/00-intro/pics/
  • wizard_start_en.png · references/book/00-intro/pics/
  • 0000-book.md · references/book/
  • 0014-basis.md · references/book/01-basis/
  • 0015-basis-identifiers.md · references/book/01-basis/
  • 0016-basis-builtin-types.md · references/book/01-basis/
  • 0017-basis-builtin-types-integer-numbers.md · references/book/01-basis/
  • 0018-basis-builtin-types-float-numbers.md · references/book/01-basis/
  • 0019-basis-builtin-types-characters.md · references/book/01-basis/
  • 0020-basis-builtin-types-strings.md · references/book/01-basis/
  • 0021-basis-builtin-types-booleans.md · references/book/01-basis/
  • 0022-basis-builtin-types-datetime.md · references/book/01-basis/
  • 0023-basis-builtin-types-colors.md · references/book/01-basis/
  • 0024-basis-builtin-types-enums.md · references/book/01-basis/
  • 0025-basis-builtin-types-user-enums.md · references/book/01-basis/
  • 0026-basis-builtin-types-void.md · references/book/01-basis/
  • 0027-basis-variables.md · references/book/01-basis/
  • 0028-basis-variables-define-vs-declare.md · references/book/01-basis/
  • 0029-basis-variables-scope-and-lifetime.md · references/book/01-basis/
  • 0030-basis-variables-initialization.md · references/book/01-basis/
  • 0031-basis-variables-static-variables.md · references/book/01-basis/
  • 0032-basis-variables-const-variables.md · references/book/01-basis/
  • 0033-basis-variables-input-variables.md · references/book/01-basis/
  • 0034-basis-variables-variables-extern.md · references/book/01-basis/
  • …and 140 more

SKILL.md (first lines)

# MQL5 Development Skill

Expert development skill for MetaTrader 5. Covers EA, Indicator, Script,
and Service creation with emphasis on trading operations, technical
indicators, multi-timeframe analysis, risk management, and backtesting
workflows. Detailed reference material, code templates, and deal-debug
methodology live outside this file (see §10 for the index).

## 1. MQL5 Fundamentals

### Language and File Types

MQL5 syntax is similar to C++ with domain-specific additions.
Source: `*.mq5` (programs), `*.mqh` (headers). Compiled output:
`*.ex5` (same name as source). Compiler: built into MetaEditor IDE.

### Program Types

| Type           | Purpose            | Key Handler    | Directory          |
|----------------|--------------------|----------------|--------------------|
| Expert Advisor | Automated trading  | `OnTick()`     | `MQL5/Experts/`    |
| Indicator      | Technical analysis | `OnCalculate()`| `MQL5/Indicators/` |
| Script         | One-shot execution | `OnStart()`    | `MQL5/Scripts/`    |
| Service        | Background task    | `OnStart()`/`OnTimer()` | `MQL5/Services/` |

### MQL5 Directory Structure

Default: Windows — `$env:USERPROFILE\AppData\Roaming\MetaQuotes\Terminal\$INSTANT_HEX\MQL5`;
Linux/Wine — `~/.wine/drive_c/Program Files/MetaTrader 5/MQL5/`.

Key subdirs: `Experts/`, `Indicators/`, `Scripts/`, `Services/`,
`Include/Trade/` (CTrade, PositionInfo), `Include/Indicators/`,
`Include/Expert/`, `Include/Generic/`, `Files/`, `Logs/`.

### Multi-Instance MT5

Multiple MT5 instances can run concurrently (e.g. one per demo
account, one per broker). Each has its own `MQL5/`. To distinguish:
`AccountInfoInteger(ACCOUNT_LOGIN)`, `ACCOUNT_NAME`, `ACCOUNT_SERVER`.
**Use Magic Number** to distinguish EA trades across instances on
the same symbol — each instance should own a unique magic.

### Code Style and Conventions

Naming (classes `C`+PascalCase, methods PascalCase, members `m_`+camelCase),
class structure (private→protected→public), and MQH declaration/definition
split: `references/quick-ref-code-style.md`.

## 2. Trading Operations

### Order vs Deal vs Position

- **Order**: instruction to buy/sell (Market or Pending).
- **Deal**: executed exchange (buy at Ask, sell at Bid).
- **Position**: current obligation (long or short).

Full API: `references/docs/19-trading/` (34 files, pattern
`0801-trading-ordercalcprofit.md`). For functions not listed below,
read the corresponding doc file.

### CTrade Class (Standard Library)

```mql5
#include <Trade\Trade.mqh>
CTrade trade;
trade.SetExpertMagicNumber(EA_MAGIC);
trade.SetMarginMode();
trade.SetTypeFillingBySymbol(Symbol());
trade.SetDeviationInPoints(Slippage);
```

Key methods: `PositionOpen`, `PositionClose`, `PositionModify`,
`PositionClosePartial`, `Buy`/`Sell`, `BuyLimit`/`BuyStop`/etc.,
`ResultRetcode` (always check after open), `ResultDeal`. Full setup
template: `assets/templates/ea-skeleton.mq5`.

### Order Execution Pattern

```mql5
double price = (signal == ORDER_TYPE_BUY)
    ? SymbolInfoDouble(_Symbol, SYMBOL_ASK)
    : SymbolInfoDouble(_Symbol, SYMBOL_BID);
trade.PositionOpen(_Symbol, signal, lotSize, price, sl, tp, "EA Signal");
if (trade.ResultRetcode() != TRADE_RETCODE_DONE)
    Print("Trade failed: ", trade.ResultRetcode());
```

### Hedging vs Netting

```mql5
bool IsHedging = ((ENUM_ACCOUNT_MARGIN_MODE)
    AccountInfoInteger(ACCOUNT_MARGIN_MODE)
    == ACCOUNT_MARGIN_MODE_RETAIL_HEDGING);
```

- **Hedging**: multiple positions per symbol; iterate `PositionsTotal()`
  + match Magic Number.
- **Netting**: one position per symbol; use `PositionSelect(_Symbol)`.

## 3. Indicators and Multi-Timeframe

### Built-in Indicator Handles

| Indicator        | Function                                            |
|-----------------|-----------------------------------------------------|
| Moving Average  | `iMA(_Symbol, PERIOD, period, 0, mode, price)`      |
| RSI             | `iRSI(_Symbol, PERIOD, period, PRICE_CLOSE)`        |
| MACD            | `iMACD(_Symbol, PERIOD, fast, slow, sig, price)`    |
| Bollinger Bands | `iBands(_Symbol, PERIOD, period, 0, dev, price)`    |
| ADX             | `iADX(_Symbol, PERIOD, period)`                     |

Full API in `references/docs/26-indicators/` (41 files, pattern
`0969-indicators-i<name>.md` — e.g. `iadx`, `iatr`, `ifractals`).
Read the doc file rather than guessing the API for indicators not
listed above.

### Reading Indicator Values

```mql5

From ZhijuCen/mql5-skills, MIT.

Signals

Stars
2
Forks
0
Open issues
0
Last commit (this folder)
Sep 22, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
0.1
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from ZhijuCen

Cite this page

mql5 skill. Agent Mart. https://agentmart.dev/skills/zhijucen-mql5 (last updated 2026-10-24)