3.4 KiB
3.4 KiB
SKILL.md Design — skills/mql5
This document describes the content and structure of skills/mql5/SKILL.md,
conforming to the AgentSkills.io Specification.
Frontmatter
---
name: mql5
description: >
MQL5 development skill for MetaTrader 5. Covers Expert Advisors, Indicators,
Scripts, and Services. Focus on positions, orders, indicators, ticks, and bars.
Includes programming book and API reference documentation.
version: "0.1"
license: MIT
compatibility: >
Target: MetaTrader 5 platform. Language: MQL5 (C++-like syntax).
File extensions: *.mq5 (source), *.mqh (headers).
References: mql5.com/en/book (programming), mql5.com/en/docs (API).
metadata:
project-version: "0.1.0"
sources:
book: sitemaps/sitemap_book_en.xml (581 URLs)
docs: sitemaps/sitemap_docs_en.xml (4135 URLs)
focus-areas:
- positions
- orders
- indicators
- ticks
- bars
---
Body Content Structure
The body should be structured as follows:
1. Overview
Brief description of MQL5 and MetaTrader 5:
- MQL5 is the programming language for MetaTrader 5
- Syntax similar to C++
- File types:
.mq5(source),.mqh(headers) - Program types: Expert Advisors, Indicators, Scripts, Services
2. Quick Reference — Key Operations
Focus areas with concise API patterns:
Positions
CTradeclass for position managementPositionGetSymbol(),PositionSelect(),PositionGetDouble()CTrade::PositionOpen(),CTrade::PositionClose()
Orders
CTrade::OrderSend()for pending ordersORDER_TYPE_BUY_LIMIT,ORDER_TYPE_SELL_LIMIT, etc.OrderGetTicket(),OrderSelect()
Indicators
iMA(),iRSI(),iMACD(),iBands()— built-in indicatorsCopyBuffer()to read indicator valuesIndicatorCreate()for custom indicators
Ticks
SymbolInfoTick()— current tick dataMqlTickstructure:bid,ask,last,volume,timeOnTick()handler for Expert Advisors
Bars
Bars(),BarsCalculated()— bar countCopyOpen(),CopyHigh(),CopyLow(),CopyClose(),CopyVolume()CopyRates(),CopyTime()CTerminalInfo,CSymbolInfofor symbol/bar info
3. Program Types
| Type | Purpose | Key Handler |
|---|---|---|
| Expert Advisor | Automated trading | OnTick(), OnInit(), OnDeinit() |
| Indicator | Technical analysis | OnCalculate() |
| Script | One-shot execution | OnStart() |
| Service | Background task | OnStart(), OnTimer() |
4. Common Patterns
- Trade execution with error handling
- Indicator buffer management
- Timer-based operations
- Chart object manipulation
- File I/O for logging/data
5. References
Point to the extracted documentation:
references/book/— Programming book (learning path)references/docs/— API reference (function/type lookup)
6. Pitfalls & Best Practices
RefreshRates()before trading operationsNormalizeDouble()for price comparisons- Check
Retcode()after trade operations - Use
CTradeclass over rawOrderSend() - Handle
OnTimer()for periodic operations - Test with Strategy Tester before live deployment
Implementation Notes
- The SKILL.md should be concise (< 1024 chars for description, body can be longer)
- Body is loaded as context by AI agents — prioritize actionable patterns
- Reference files provide depth; SKILL.md provides the "what to do"
- Version 0.1: initial content, will expand as extraction completes