gpt4 book ai didi

mql4 - 如何使用命令行工具编译 MQL4 文件?

转载 作者:行者123 更新时间:2023-12-02 10:59:50 24 4
gpt4 key购买 nike

现在我正在使用 MetaEditor< 将 MetaTrader .mq4 文件编译为 .ex4 文件/kbd>.

但是我的 .mq4 文件是由 Java 进程生成的,我想自动化编译过程。

是否有可以通过编程方式调用的命令行编译器工具?

最佳答案

要从命令行编译源代码文件,您可以使用 MetaEditor。例如:

metaeditor.exe /compile:"C:\Program Files\Platform\MQL5\Scripts\myscript.mq5"

对于 64 位,请使用 metaeditor64.exe

在 Linux/macOS 中,这可以使用 Wine 来实现,例如:

wine metaeditor.exe /compile:"MQL4/Experts/MACD Sample.mq4"

对于批量编译,您可以指定文件夹,例如:

metaeditor.exe" /compile:"MQL5\Scripts"

要指定包含文件的自定义 MQL5/MQL4 文件夹,您可以使用 /inc 参数,例如:

metaeditor.exe /compile:"./Scripts" /inc:"C:\Program Files\TradingPlatform 2\MQL5"

有关编译过程的更多信息,您可以使用/log:

metaeditor.exe /compile:"C:\Program Files\Platform\MQL5\Scripts\myscript.mq5" /log 

要仅检查语法,请添加额外的 /s

如果编译失败,将在平台文件夹中创建包含相关详细信息的 MQL4.log 文件。它将采用 UTF-16 格式,因此您可能需要一个特殊的工具(例如 Vim、 Rubyfindstrrg )。

要指定自定义编译日志文件,请使用/log:file.log参数,例如

metaeditor.exe /log:errors.log /compile:.

注:Display to the standard output is not supported (尽管在 Linux 上您可以使用:/log:CON)。

有关更多信息,请查看:Compilation from the Command Line

<小时/>

不久前,您可以下载独立于 MetaEditor 运行的 MQL4/MQL5 程序编译器 — MQL.exe。它与终端分开分发,您可以在以下地址下载它:

https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mql.exe

https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mql64.exe

用法(根据 2015 年 7 月 2 日起的 MQL4/MQL5 编译器版本 1162):

mql.exe [<flags>] filename.mq5
/mql5 - compile mql5 source
/mql4 - compile mql4 source
/s - syntax check only
/i:<path> - set working directory
/o - use code optimizer

但是,独立编译器被有意删除,因此现在链接指向支持 MetaEditor 的安装程序。

<小时/>

构建 600 之前的 MetaTrader 旧版本已包含在平台中的 metalang.exe

但是,在版本 616 中,MetaQuotes 有意从标准 MetaTrader 安装中删除了编译器 (mql.exe/mql64.exe)。

这意味着如果您升级 MT 平台 (>616),编译器可执行文件将被删除。

关于mql4 - 如何使用命令行工具编译 MQL4 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14539064/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com