So far, we have discussed the basic components of trading systems , the criteria they have to meet and some of the many empirical decisions a system designer must take (see article:Principles and characteristics of trading systems ). This article will examine the process of building trading systems, considerations to be made and some key points to remember.
To start building a trading system the following elements are needed:
- Data: Because the system designer must use extensive backtesting, a complete history of past prices is essential for building a good trading system. These data can be integrated into the software system development (as in the case of Metatrader ) or can function as a separate data feed. Depending on the market, live data often provide for a monthly fee, while past price data can be obtained for free. In the case of Forex, for example, live price data are provided for free.
- Software: While it is possible to develop a trading system without software, it is very impractical. Since the late 90s, the software has become an integral part of building trading systems in many markets and is a tool used by more and more operators. Typically, these systems allow the following:
-Codificar a trading system: This software feature uses a proprietary programming language that allows the designer to create rules easily. For example, use MetaTrader MQL (MetaQuotes Language). Here 's an example of code that serves to close positions if the free margin is less than $ 1000:
If FreeMargin < 1000, then exit;
Often just reading the manual carefully and experienced designer can learn the basics of language using its software.
Automatic positioning of operations: This often requires permission from the broker that a constant connection must be implemented between the operator and the software itself broker for the execution of operations. Operations must be executed immediately and the exact prices to ensure compliance. Software to perform operations instead of the operator, all it needs to do is enter the account number and password, and from there everything is done automatically. Note that the use of this function is strictly optional.
Test of backtesting strategy: The development of trading systems without the use of backtesting is like playing baseball without a bat. Software for system development often contains a simple application of backtesting that allows the user to define a data source, enter the account information, and perform a complete test of backtesting for any interval of time with just one click with the mouse. The following figure shows the tool backtesting Metatrader4:
After running the test backtesting, a report describing the details of the results generated. This report typically includes important data such as income, number of winning trades / losers consecutive days with gains / losses, number of transactions in total, maximum drawdown (relative and absolute) and many other statistics than can be useful when trying to determine how to fix or improve the system.
Finally, the software usually creates a graph showing the growth of investment over the period of time tested. This graph may include the balance behavior and equity account throughout the period. an example of a report generated by the Metatrader backtesting platform shown in the following figure:
The basic steps to build a system are:
Trading system design
The design is the concept behind a trading system, how the parameters are used to generate a profit or loss. These rules and parameters are implemented by programming. Sometimes this programming can be done automatically via a graphical user interface. This allows the operator tocreate rules without learning a programming language. Here is an example of a system moving averages crossing using as a filter signal ADX Indicator, which measures the strength of the trend and the trend type presented by the market:
- If SMA (SMA) 20 periods crosses above the SMA 50 periods, a buy position opens.
- If SMA (SMA) 20 periods crosses below the SMA 50 periods, a short position is opened.
- Filter: Only signals of moving averages crossings that match the ADX indicator signals are accepted.
The rules how are you well defined can be used to manually operate as do many operators, or placed in a computer code that enables a software automatically generate inputs and outputs at the points where the rules are applicable. The following image shows the interface design as seen in Metatrader:
The system can be created simply by writing the rules in the window and saving them. References available for different functions (eg, oscillators and the like) can be found by clicking the book icon.Most such programs have a similar reference system available either within the program itself or on its website. After creating the desired rules and code the system simply save the file. Then we can put you in selecting use in the home screen.
Decision making
There are many decisions to be taken at this point:
- What I want to operate market, Forex, Futures, Stocks?
- What time should I use?
- What are the ideal conditions to apply my system?
- What price range should I use?
- What time periods should I use for testing?
Note that trading systems should be able to profit more or less constant in markets that usually vary greatly. To customize the time and price series too, can affect the results and produce little unrealistic and applicable results.
Practice and evaluation system
The backtesting and paper trading are essential for the successful development of a trading system. Moreover, given the abundance of brokers who offer demo accounts for unlimited practice time, there is no excuse today for not prove a trading system extensively with virtual money in a demo account before using it to operate with real money. We must remember that a system that has not been properly assessed can lead to heavy losses.
When evaluating a trading system through backtesting and paper trading must keep in mind the following tips:
- Backtesting run multiple tests at different periods of time and make sure that the results are consistent and satisfactory.
- Test your system on a demo practice account (using virtual money), and again, look for consistent profitability. During this test it is important to register all operations and results to be able to detect system failures and conditions which produce the best and the worst results.
- In the case of automated trading systems, carefully check for errors in the program, or unwanted operations, which sometimes can occur. These errors may be the result of faulty programming or impossible to foresee certain circumstances they have undesirable effects.
Repeat if necessary and work on the system
Repetition is necessary. Sigua working on the system until you can make a profit in most markets and conditions. there are always unforeseen events that happen as soon as one starts to use system. Here are some factors that often cause skewed results:
- Transaction costs: Make sure you are using real data fees and expenses, and some additional aspects to account spreads (difference between buying price and selling) and inaccurate executions. In other words, avoid slippage. If we do not include transaction costs evaluation results of a system can be misleading.
- Security: Do not ignore the losing trades; carefully monitor all operations generated by the system, both positive and negative.
- Optimization: Be careful not to over-optimize the system. In other words, do not make the common mistake so too the system to adapt to a very specific market environment. Try to make the system profitable in such a large environment as possible.
- Risk: Never ignore or forget the risk. It is very important to have ways to limit losses (such as the famous stop-loss), and ways to ensure profits (profit - taking).
Finally, use the system to operate live
If all goes well, the final step is to test the live system and operate with real money, that's why it was created, but do not be surprised if there are undesirable results. It is important to use the trading system manually at the beginning and not automate until you are sure the performance and consistency of the system.
It takes a long time to develop a system of successful trading, and before it perfect, you may have to endure some losses to its operations under real conditions to detect faults: the backtesting can not perfectly represent market conditions Live and paper trading even in demo accounts may be inaccurate. If your system loses money, go back to the drawing board and see where failed (see previous step).