百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

mtapi

> 编程语言
开源

MetaTrader API (终端桥)

682 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

MetaTrader API (终端桥)

Introduction

MtApi provides a .NET API for working with famous trading platfrom MetaTrader(MetaQuotes).
It is not API for connection to MT servers directly. MtApi is just a bridge between MT terminal and .NET applications designed by developers.
MtApi executes MQL commands and functions by MtApi's expert linked to chart of MetaTrader.
Most of the API's functions duplicates MQL interface.
The project was designed using WebSocket framework with the intention of using flexibility to setup connections.

Build environment

The project is supported by Visual Studio 2022 and based on .NetCore (.Net 8). It requires HeatWave for VS2022 - set of tools for creating WiX installation packages (https://marketplace.visualstudio.com/items?itemName=FireGiant.FireGiantHeatWaveDev17). Just install the VS extensions.

Use MetaEditor to working with MQL files.

How to Build Solution

To build the solution for MT4, you need to choose the configuration to build for x86 and start with building the MtApiInstaller. This will build all projects related to MT4:

  • MtApi
  • MtClient
  • MtService
  • MTConnector

For building the solution for MT5, you need to choose the configuration to build for x64 (or x86 for the 32-bit MT5)) and start build MtApi5Installer. This will build all projects related to MT5:

  • MtApi5
  • MtClient
  • MtService
  • MT5Connector

All binaries are placed in the project root folder, in the build directory: ../build/.
The installers (*.msi) will be found under: **../build/installers/**. All the DLL library binaries (***.dll**) in: **../bin/`.

MQL files have been pre-compiled to *.ex4 and can be found in the repository here:

  • ..\mql4\
  • ..\mql5\

Changing the source code of the MQL Expert Advisor (EA), requires recompilation with MetaEditor.

Before you can recompile the EA, you need to add/place the following MQL library files, in the MetaEditor ../Include/ folder.

  • hash.mqh
  • json.mqh

The MetaEditor include folder is usually located here:

xml
C:\Users\\AppData\Roaming\MetaQuotes\Terminal\\MQL5\Include\.

Project Structure

  • MtService: (C++, .dll)
    The common engine communication project of the API. It contains the implementations of server sides based on WebSocket (from Boost library).

  • MtClient: (C#, .dll)
    The client side communication project of the API (based on WebSocket).

  • MTConnector, MT5Connector: (C++, .dll)
    The libraries that are working as proxy between MQL and C# layers. They provides the API interfaces for working with MQL experts.

  • MtApi, MtApi5: (C#, .dll)
    The client side libraries that are using in user's projects.

  • (MQL4/MQL5, .ex4/.ex5)
    MT4 and MT5 Expert Advisors linked to terminal's charts. They executes API's functions and provides trading events.

  • MtApiInstaller, MtApi5Installer (WIX, .msi)
    The project's installers.

  • Boost libraries (*.lib)
    Precompiled x64 and x86 libraries for using with C++ projects, placed in [root]\thirdparty.

Installation

Use the installers to setup all libraries automatically.

  • For MT4, use: MtApiInstaller.msi
  • For MT5, use: MtApi5Installer_x64.msi

To quickly navigate to the trading platform data folder, click: File >> "Open data folder" in your MetaTrader Terminal.

Additional packets

VCRedist packet must be installed for correct working MtApi connectors (MTConnector or MT5Connector). Use Microsoft website to download required installers: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170

Using

MtApi provides two types of connection to MetaTrader terminal: local and remote (via TCP).
The port of connection is defined by MtApi expert.

Console sample for MT5:

…

Telegram Channel

https://t.me/joinchat/GfnfUxvelQCLvvIvLO16-w

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#apimetatradermetatrader5mql4

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言