该库使用简短的描述性文本来说明 MQL5 参考中存在的每个错误。随着官方文档中不断添加新的错误,该库将经常更新。
最后更新: 2024-02-29
使用示例:
(不要忘记将ErrorDescription2.mq5 文件 复制到 文件夹:MetaTrader 5\MQL5\Include)
//+------------------------------------------------------------------+
//| test.mq5 |
//| Copyright 2024, Paulo Henrique |
//| https://www.mql5.com/en/users/pau1ohenrique.dev |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Paulo Henrique"
#property link "https://www.mql5.com/en/users/pau1ohenrique.dev"
#property version "1.00"
// Includes
#include <ErrorDescription2.mqh>
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnStart()
{
//--- usage example #1
Print("Description of MQL5 errors:");
for(int i=FIRST_RUNTIME_ERROR; i<=LAST_TRADE_SERVER_ERROR; i++)
{
string error_desc=GetError(i);
if(IsSuccess(i) || error_desc==NULL)
continue;
if(IsRuntimeError(i))
Print("RuntimeError: ",error_desc);
if(IsTradeServerError(i))
Print("TradeServerError: ",error_desc);
if(IsUserError(i))
Print("UserError: ",error_desc);
}
//--- usage example #2
Print("\nLast error description:");
int retcode=GetLastError();
if(!IsSuccess(retcode))
Print(GetError(retcode));
//--- or simply
Print(GetError());
// The operation completed successfully [0]
// Unexpected internal error [4001]
// ...
Print(GetError(false));
// The operation completed successfully
// Unexpected internal error
// ...
}
//+------------------------------------------------------------------+
我很快就会发布一个类库,它可以简化 MQL5 中错误的使用,包括使用 Raise(my_error) 方法简化用户错误报告。
由MetaQuotes Ltd译自葡萄牙语
原代码: https://www.mql5.com/pt/code/48431
ONNX 交易员
一个带有嵌入式机器学习模型的机器人示例,该模型用 python 进行训练,并以 ONNX 格式保存。
Intraday Currencies Performance
单个货币的简单观察站。
CVD (Cumulative Volume Delta)
MT5 的轻量级 CVD(累计成交量Δ) - 基于 M1,以蜡烛图显示买入/卖出压力,可选择重置。
Local Timezones and Local Session Hours
类,用于访问指定地点的当地时间、时区信息和当地交易时段。