The natural desire to keep pace with time, forcing many, especially traders, is just beginning to work in the financial markets, to choose a modern trading platform, which will continue to develop and maintain. One of the candidates can be prepared for release in the near future trade-information complex MetaTrader 4.
As in the choice of platform traders intend to write your own indicators and trading systems should pay close attention to the programming language, then in order to help them to orientate themselves in this situation, we compare three programming language used in the modern trading platforms. The first two programming language - it is already mentioned EasyLanguage for TradeStation terminal and used in the present version of the trade terminal MetaTrader programming language MQL II. Third, in connection with the upcoming release of new versions of light commercial and informational complex MetaTrader 4, our review has got used to it a programming language MQL4.
Despite the fact that in today's review will involve only three languages, this story can serve as a starting point to determine the capabilities of any other programming language used in the modern trading systems.
So, to start it should be noted that the formal description of MQL II language states that it is syntactically highly similar to EasyLanguage, which means that a programmer familiar with the latter, could easily understand what is written in the program for the MQL II.
Apparently, when a group of designers the company MetaQuotes Software question for inclusion in the first version of the terminal MetaTrader convenient and easy to explore programming language, they felt that the right to make available to writers of the language programs are very similar to the familiar and well-established language EasyLanguage. That decision freed programmers from many of the difficulties associated with the transition to a new programming language, and has enabled a large audience of traders almost painless to take advantage of their ideas for the new TradeStation platform.
In support of the above, further contains syntactically correct expressions in the languages of EasyLanguage and MQL II:
Sample code in EasyLanguage
If Close [0]> Close [1] then begin
Condition1 = Low [0]
Condition2 = RSI (Close, 14) <30;
End;
Sample code to MQL II
If Close [0]> Close [1] then begin
Condition1 = Low [0]
Condition2 = iRSI (14,0) <30;
End;
You can see that the difference occurs only in the third line, when you want to get value indicator RSI, in the rest of the code is identical.
Over time, weaknesses have become clear MQL II, and by developing a new version MetaTrader'a in MetaQuotes Software decided to offer for programming a new programming language MQL 4, which seems to have managed to combine the best of his two predecessors. " In addition, it appeared very useful innovation, extending the capabilities of programmers.
Try to show some of the most important, in our opinion, differences MQL 4 of EasyLanguage and MQL II.
1. The structure of the program for the MQL 4 gained a clear division into blocks, each performed in due time. The program consists of certain functions init (), deinit () and statr (), that run at startup, respectively, and in the process of completing the program. Program for EasyLanguage and MQL II contained all the challenges and directions in a common block, and many, especially novice programmers, hampered write code block, which would be implemented only once, when you first start the program.
2. Indicator written in EasyLanguage, can contain a maximum of only four lines indicator. Indicator written in MQL II, may otrisovat even fewer lines of display - only two lines. Language MQL 4 is a function SetIndexValue, which as the first parameter takes the number of index data draw the line, and, judging by the fact that the index is type integer, then in theory, this function could specify the data for 32768 lines. In reality, this number is likely to be limited by a reasonable number to thirty.
3. Languages EasyLanguage and MQL II were able to work only with arrays of fixed length, the size of the array to be a programmer to guess at a stage of writing the program. This made certain restrictions on the algorithms. MQL 4 contains all you need to work with arrays, which can be changed dynamically programmer - in the work program.
4. Language MQL 4, due to the import function from any Shared Libraries (from the files with the extension. Dll) can now perform all kinds of system calls. This shortcoming can be eliminated almost all the missing features.
5. EasyLanguage Syntax when placed orders for the purchase, sale and closing of the warrants has a lot of nuances. MQL 4 language inherited from the MQL II comfortable, from the standpoint of the programmer, the method of insertion orders.
6. MQL II language is not permitted to work with multiple tools at once from one program that is not allowed to write the complex indicators, based on data from several time periods, and are not allowed to test the trading system at the portfolios of currencies. In MQL 4 the opportunity appeared.
7. Some changes to the syntax allowed to write readable programs. Denial of the use of MQL 4 operator brackets "Begin ... End", used both in MQL II, and in EasyLanguage, led to the source code of programs perceived significantly easier in such programs primarily visible essence. Despite the apparent triviality of this change, it could significantly ease the life of programmers, especially beginners.
8. In MQL 4 get rid of ambiguity operator "=", which in language MQL II and EasyLanguage, depending on the context of use, means two different steps: assigning a new value of the variable and comparison of two values. Now, in the case of the assignment to the "=", and to check on the equality of the two values is used "==".
For objectivity should be notice that there are trading systems that offer programming to use advanced programming languages such as VBScript and JavaScript. But these languages because of its universality, a few newcomers to explore the complex and, in particular, people far from the programming.
Alexander Ivanov
to Forex Magazine
fxtrade@tomsk.ru
to Forex Magazine
fxtrade@tomsk.ru
No comments:
Post a Comment