Automated Trading Systems for Financial Markets and Recommendations for Their Usage
Today, using information and trading platforms has become a de facto requirement for successful trading in the financial markets. Their advantages as compared to conventional trading schemes include, for example, an unprecedented speed of processing and delivery of information to end users, the level of integration with data providers, and a wide array of built-in technical analysis instruments.
At the same time, an investor opening an account with a brokerage firm simply cannot simultaneously manage the real-time analysis and trade in more than 4-6 financial instruments in several markets 24 hours 7 days a week. This brings about the need to employ automatic trading systems in the form of runtime environment with client and server parts and the programs to control these systems (scripts).
2. Comparative Analysis of the Problem Area
Various software components embrace the entire target sector of the market-from analytics and forecasting to complex trade and administration. The components of a trading platform provide its clients-brokers, dealers, traders, financial analysts and advisors-just the service they need at the very moment they need it, from immediate round-the-clock access to information of concern by means of mobile devices, to multi-move trading operations in the major client terminal.
The software market offers a great many of information and trading platforms that differ, first of all, in the functionality of the client and server parts, and the list of services provided by the financial company once an account has been opened. However, only a relatively small number of software solutions include the components that automate trading.
2.1. MetaTrader 4 Based Solutions
One of the world's most widely used trade platform products is apparently MetaTrader 4, developed by MetaQuotes Software Corporation for Forex market trading. The platform includes an integrated development environment (IDE) MetaEditor, intended for writing scripts in a programming language called MetaQuotes Language, or MQL4 for short. The language's syntax is based on the classic C language syntax, and the flow logic has not been significantly changed since the previous version of the platform that used MQL II as the programming language.
The new automated trade framework is, undoubtedly, an evolution of the previous one. Both languages feature good functionality, with an optimum set of built-in trading and utility functions which is quite sufficient to implement the basic operations, and a facility to define custom functions to help implement non-standard ideas.
From the programming point of view, MQL4 is much more convenient that its predecessor; this language is more oriented at professional programmers, while MQL II, in my opinion, will rather suit financial experts wishing to build trading programs (or trading advisors, in the MetaQuotes terminology) of their own.
2.2. Omega Research Based Solutions
In the New World, the vast majority of companies use the Omega Research platform developed by TradeStation Securities, Inc. This platform has long ago proven its worth at the worldwide market, and to date experts consider it to be the best system for technical analysis. The provided IDE called Omega Research PowerEditor is intended to create control programs in EasyLanguage (EL).
The language's major advantage that strikes the eye is the easiness (hence is the name) of placing opening and closing orders. The corresponding program instructions can be written such as if we were formulating an order to our broker in the plain human language. In MQL4, for example, placing an order to open a position would involve specifying about a dozen of various parameters. In EasyLanguage, the same can be expressed in a short statement using a few words. Working with technical indicators is about that simple, too. But don't fall under an illusion: when creating these simple commands, language developers sacrificed the functionality and limited the possible ways of using a particular function, therefore effectively depriving the IDE users of the opportunity to accurately implement their own algorithms.
TradeStation decided not to create extensive libraries of built-in trading and utility functions but to limit to only an essential set. As the platform advanced, the number of functions written by both in-house and third-party developers grew, and TradeStation simply included them as user-defined functions into the repository of its scripts. As a result, the functionality offered to users is not in the least scarcer than that of MetaQuotes product.
PowerEditor provides a built-in dictionary that lets user search and get help on the available functions. Another handy tool worth mentioning is the strategy builder. Using the strategy builder, the user can easily create a basic algorithm for his or her trading program, and then modify and adjust it as necessary.
EasyLanguage is an old-timer and pioneer in the field of creating automated trading systems for the stock market. It was the basis for the development of MQL II. EasyLanguage will be a good choice for programmers, but still a better one for financial experts more oriented at analyzing the market than trading.
2.3. ProTrader Based Solutions
Professional financial experts can choose the ProTrader2 or ProTraderFX platform as their working tool, depending on the type of the financial market-stock or Forex, respectively. The two platforms are developed and supported by PFSoft LLC. While featuring the specially developed ProTrader Language (PTL), the provided IDE named PTL Builder offers also the opportunity to create scripts in MQLII, MQL4 and EasyLanguage. For this, the text of the program is translated to a language-independent code. Therefore, at runtime it does not matter in which language the script was written. This technology does not only enable creating new scripts, but makes it possible to use freely the entire accumulated collection of scripts that many experienced traders possess.
The main idea put into the new scripting language was to ensure maximum reliability and predictability of the scripts being run. The PTL language is built so as to minimize the possibility of making a mistake in the text of a user's script-the potentially dangerous points will be detected even before the script is tested or launched.
Regardless of the programming language chosen, the platform works with verified managed code while running the script. This Microsoft-developed technology enables proper handling of errors that cannot be detected before the script is run. This means the program will not fail and will not perform any unwanted operations that might be due to critical errors or damage caused by another program, for which the account holder would eventually have to pay.
The PTL Builder IDE will serve well both financial experts and programmers thanks to its support of different programming languages and provided tools such as tester and debugger.
2.4. Solution Comparison
The above IDEs have their specific feature sets. The table below provides a summary comparison of the capabilities offered by each.
|MetaQuotes MetaEditor||Omega PowerEditor||PTL Builder|
|Main market type||Forex||Stock||Forex, Stock|
|Supported programming languages||MQL II, MQL4||EasyLanguage||PTL, MQL II, MQL4, EasyLanguage|
|IntelliSense||yes||no||no (in development)|
|Available in demo mode||yes||no||yes|
|Optimizer||yes||no||no (in development)|
|Other available project types||Indicator, function library||Indicator, user-defined function, market explorer||Indicator, function library|
|Copyright protection||Encrypting, setting a trial period||Encrypting, integrating scripts into encrypted files||Encrypting, setting a trial period, protecting with password|
3. Approaches for Creating Automated Trading Systems and Recommendations for Using Them
It hardly needs mentioning that choosing an information and trading platform should be taken with all seriousness. For those who plan to use an automated trading system in their business, below are some points I would recommend considering, based on my personal experience.
3.1. Choosing a Working Environment
First of all, define the type of tasks the automated trading system is to perform. These could be:
- Actual trading: opening and closing positions in selected instrument(s).
- Secondary support-type functions. These could include placing protective orders, creating and sending out reports of notifications.
- Analyzing the market with different technical analysis tools using your own algorithm.
Now, after you have studied user comments on the Internet and perhaps consulted your broker, proceed to getting the feel of the products offered. I strongly encourage you not to just have a cursory look, but to test the system for a day of two, thankfully, most of the large companies will let you sign up for a demo account for testing. Pay attention to both the convenience of the IDE and the tools that go with it, and to reliability and security of the control programs created with the IDE.
3.2. Creating a Control Program
If you are planning to create your own scripts, take the time to study the documentation for the programming language and the IDE. Naturally, for an automated trading system to be expertly organized, the scripts should be written by qualified professionals in the field of programming and finance. In case you wish to use one of the classic programs, remember that most of them are of trial, demonstration nature. They are good for testing the automated trading system or to be used as a basis for your own programs, but as self-sustaining, ready-to-use solutions they are of little avail.
If you decide to use programs written by third-party developers, keep in mind that good solutions will have to be paid for. The cost of one innovative strategy varies between $300 and $500, but the price for fine-tuned strategies that use advanced mathematical and economic techniques and especially for winners and runners-up of automated trading championships may exceed $1,000.
3.3. Testing Scripts
When using an automated trading system, always test your scripts. The procedure can be as follows:
- Test the program in a script tester (if such facility is available in your IDE) several times, varying the chart period, the instrument being traded, and the program settings. Try to model the conditions close to the actual state of the market.
- Test the script in a demo account (if such an opportunity is available). At this stage, it is important to let the program run for a sufficiently long time (it is defined by the period of the chart). Do not stop the test if the program has at once produced a big gain or a big loss. The usefulness of the script can only be estimated after it has worked for a significant amount of time.
- Run the script in the live account. At this stage, it is not advisable to interfere with the script-for example, close the positions it has opened or modify their settings-or you can upset the internal logic of the program.
3.4. How Not to Fall Prey to Tricks When Choosing a Script
Remember that there are no absolutely perfect advisers. So, do not let them sell you the Brooklyn Bridge-if you had a system that brings in fabulous profits, would you sell it? There is only one advice-a rigorous comprehensive testing will help you get the right impression about the script offered.
Usually, script vendors describe their products with the results of their own testing. In most cases, however, such results are very slanted. Remember that testing should always be performed on several histories, or you can simply adjust to one history fragment and show sky-high results. Based on the NFL theorem, it is fair to say that it is impossible to create a script that would the best of all those existing, in all instruments.
Some professional programmers use sophisticated mathematical tools to endow their programs with artificial intelligence-neural networks, forecasting and evolutionary algorithms are no longer surprising. I would not recommend overestimating such systems-complex forecasting algorithms are very sensitive to errors and parameter settings, while simple schemes are not of much help to the advisor when it comes to generating trade signals, and can only be used to raise the price of the script.
In this article, I neither discuss any programming rules for creating the advisors, nor the specifics of writing scripts in a particular language. On these subjects, there are whole books written as well as a number of articles. My aim was to present several points which I think to be quite important but which have not been sufficiently covered in existing publications.
So, are automated trading systems your ally or enemy? When used carefully and without hasty judgments, an automated trading system can facilitate the financial expert's work and bring in certain profits. But when used incorrectly, incompletely tested, or having settings changed frequently, the automated trading system can lose the money you entrust to it.
Remember that an automated trading system is not going to do your job for you without any effort on your part. Use it to solve your existing problems and not add new ones.
- MetaQuotes developer of MetaTrader, MQLII and MQL4
- TradeStation developer of TradeStation and EasyLanguage
- PFSoft developer of ProTraderFX, ProTrader2, and ProTraderLanguage
by Nikita Laukhin
Automated trading and scripts analyst at PFSoft Company.