- 1、本文档共67页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
MT4新手编程资料
MQL4 Language for Newbies. Technical Indicators and Built-In Functions [ ru ]
Introduction
This is the third article from the series MQL4 Language for Newbies. In the first two articles we learned the fundamentals of MQL4, the basis of further development. Now we will learn to use built-in functions and functions for working with technical indicators. The latter ones will be essential in the future development of your Expert Advisors and indicators. Besides we will see on a simple example, how we can trace trading signals for entering the market, for you to understand, how to use indicators correctly. And at the end of the article you will learn something new and interesting about the language itself.
Mathematical Functions
Let us start with the most simple, but still used and helpful mathematic functions.
MathAbs
Function Prototype:
double MathAbs(double value)
It is a very simple function, which returns the absolute value (number module). It means, if you, for example, use it for a negative number, as a result you will get a positive number.Example of its usage:
int a=-10;
double b=-20.0;
double c=7.0;
a=MathAbs(a); // now a is equal to 10
b=MathAbs(b); // now b is equal to 20.0
c=MathAbs(c); // the value of c will not change, for it was positive
MathCeil, MathFloor and MathRound
Functions prototypes:
double MathCeil(double x)
double MathFloor(double x)
double MathRound(double value)
These three functions are very much alike: all they round off a number to the whole number. But each of them has its own peculiarity:MathCeil rounds up in such a way, that even if we have one thousandth of a whole number (for example, 1.001), it is considered a whole number. I.e. a number is rounded up to a higher value. For example:
double a;
a=MathCeil(1.001); // a=2.0, even one thousandth is rounded off to a whole number
a=MathCeil(1.999); // a=2.0
a=MathCeil(-1.001); // a=-1.0, it is correct, because -1.0 is more than -1.001
a=MathCeil(-1.999); // a=-1.0, it is correct, -1
文档评论(0)