分类
超短线交易秘诀

MetaTrader 4的技术指标程序库用MQL4进行开发

MQL4 Source Codes of Libraries for MetaTrader 4

Libraries are small sub-programs that can be used for developing new applications. They do not execute trading or analytical functions and cannot be run in MetaTrader 4. Their purpose is to simplify development of new applications in MQL4.

These applications can be downloaded and used in the editor of trading strategies MetaEditor.

MetaTrader 4的技术指标程序库用MQL4进行开发

MetaQuotes Language 4 (MQL4) is the language for programming of trade strategies built in the client terminal. It allows to write custom expert advisors that automate trade processes and ideally suit for implementation of traders' own strategies. Moreover, traders' own custom indicators, scripts and DLL's can be created in MQL4.

Syntax of MQL4 is quite similar to that of C language. A large amount of functions necessary to analyze quotes, manage positions, call technical indicators, and others, are included in MQL4. The MetaEditor, an MetaTrader 4的技术指标程序库用MQL4进行开发 editor for expert advisors, is used for writing the source code of programs. The MetaQuotes Language Dictionary that contains descriptions of all language constructions and functions is built in the editor.

MetaQuotes Language 4

Fast, flexible and efficient programming language for developing trading robots

MetaQuotes Language 4 (MQL4) is an integrated programming language for developing trading strategies allowing you to create trading robots, technical indicators, scripts, and function libraries for use on the MetaTrader 4 trading platform. All these instruments significantly enhance traders' abilities when trading Forex.

MetaQuotes Language 4 is based on the concepts of the popular С++ programming language. MQL4 is also a MetaTrader 4的技术指标程序库用MQL4进行开发 high-level object-oriented programming language. The operation speed and flexibility of the language allow you to develop very complex programs with large amount of calculations and accurately manage almost all Expert Advisor and indicator parameters.

MQL4 contains a large number of functions MetaTrader 4的技术指标程序库用MQL4进行开发 which are necessary for analyzing current and previously received quotes, and has built-in basic indicators and functions for managing trading orders and controlling them.

With MQL4 you can develop various programs for analyzing of the markets and for trading automatically:

MetaTrader 4的技术指标程序库用MQL4进行开发

模板是指标的基本源代码。 它包括主要事件处理器的标准程序头,常规属性和工件: 数值重计算(OnCalculate)和指标启动(OnInit)。 模板会在与程序类型相应的目录中创建 ― MQL5/Indicators (或 MQL4/Indicators)。 当创建模板时,可以事先定义程序输入,并将其添加到工件代码中以获取其它事件处理器和图形构造。

创建指标

  • 名称 ― 指标名称。 相同名称将被分配给它的文件。 在此,您还可以更改目标文件的路径。 例如,在新的 \Indicators 子文件夹中创建它。
  • 作者 ― 作者名。
  • 链接 ― 开发者的电子邮件地址或网站。
  • 参数 ― 指标输入参数集(外部变量)。

输入参数是 "input" 类变量。 若要创建参数,请单击添加并填写三个字段:

  • 名称 ― 输入变量名称。
  • 类型 ― 输入变量类型。
  • 初始值 ― 变量的初始值。 它可以在程序启动前或运行期间更改。

事件处理器 #

接下来,选择附加的 事件处理器。 它们的工件将被插入到 EA 模板中。 OnCalculate 处理器是必需的,因此您只能选择其类型,而不能将其删除。