วันศุกร์ที่ 29 กรกฎาคม พ.ศ. 2554

Trading Systems: Constructing A System

Trading Systems: Constructing A System

So far, we have discussed the basic components of trading systems, the criteria they have to meet, and some of the many empirical decisions that a system designer must make. In this section, we will examine the process of constructing a trading system, the considerations that need to be made, and some key points to remember.

The Six-Step System Construction

1. Setup - To begin constructing a trading system you will need several things:
  • Data - Because the system designer must use extensive backtesting, past price history is essential to constructing a trading system. Such data can be integrated into trading system development software, or as a separate data feed. Live data is often provided for a monthly fee while aged data can be obtained for free.

  • Software - Although it is possible to develop a trading system without software, it is highly impractical. Ever since the late '90s, software has become an integral part of building trading systems. Some common features enable the trader to do the following:

    • Automatically place trades - This often requires permission from the broker's end because a constant connection must be in place between your software and the brokerage. Trades must be executed immediately and at exact prices in order to ensure conformity. To have your software place trades for you, all you need to do is input the account number and password, and everything else is done automatically. Please note that using this feature is strictly optional.

    • Code a trading system - This software feature implements a proprietary programming language that allows you to build rules easily. For example, MetaTrader uses MQL (MetaQuotes Language). Here's an example of its code to sell if free margin is less than $5,000:

      If FreeMargin < 5000, then exit;

      Often, just reading the manual and experimenting should allow you to pick up on the basics of the language your software uses.

    • Backtest your strategy - System development without backtesting is like playing tennis without a racquet. System development software often contains a simple backtesting application that allows you to define a data source, input account information, and backtest for any amount of time with the click of a mouse. Here is an example from MetaTrader:


      After the back test is run, a report is generated that outlines the specifics of the results. This report usually includes profit, number of un/successful trades, consecutive days down, number of trades, and many other things that can be helpful when trying to determine how to troubleshoot or improve the system. Finally, the software usually creates a graph showing the growth of the investment throughout the tested time period.

2. Design - The design is the concept behind your system, the way in which the parameters are used to generate a profit or loss. You implement these rules and parameters by programming them. Sometimes, this programming can be done automatically via a graphical user interface. This allows you to create rules without learning a programming language. Here is an example of a moving average cross-over system:

If SMA(20) CrossOver EMA(13) then enter;
If SMA(20) CrossUnder EMA(13) then exit;

Rules like these that are put into code allow the software to automatically generate entry and exits at the points when the rules are applicable. Here is what the design interface looks like on MetaTrader:


The system is created by simply typing the rules in the window and saving them. References for the different functions available (for example, oscillators and such) can be found by clicking on the book icon. Most software will have a similar reference available either within the program itself or on its website. After creating the desired rules and coding the system, you simply save the file. Then you can put it into use by selecting it on the main screen.

3. Decision Making - There are many decisions to be made at this point:
  • What market do I want to trade in?
  • What time period should I use?
  • What price series should I use?
  • What subset of equities should I use for testing?

Keep in mind that trading systems should consistently make a profit in many markets. By customizing the time period and price series too much, you may taint the results and produce uncharacteristic results.

4. Practice - Backtesting and paper trading are essential to the successful development of a trading system:
  • Run several backtests on different time periods and make sure that the results are consistent and satisfactory.

  • Paper trade the system (use imaginary money, but record the trades and results), and again, look for consistent profitability.

  • Carefully check for errors in the program, or unintended trades. These can be a result of faulty programming or failure to foresee certain circumstances that have undesired repercussions.

5. Repeat - Repetition is necessary. Keep working on the system until you can consistently make a profit in most markets and conditions. There are always unforeseen events that occur as soon as a system goes live. Here are some factors that often cause skewed results:
  • Transaction costs - Make sure that you are using the real commission, and some extra to account for inaccurate fills (difference between bid and ask prices). In other words, avoid slippage! (To review what this is and how it occurs, see the preceding section of this tutorial.)

  • Watchfulness - Don't ignore losing trades; keep an eye on all trades.

  • Optimization - Don't over-optimize the system. In other words, don't tailor the system to a very specific market environment; try to be profitable in as broad of an environment as possible.

  • Risk - Never ignore or forget about risk. It is very important to have ways to limit losses (otherwise known asstop-losses), and ways to lock-in profits (take profits).




6. Trade
- Try it out, but expect unintended results. Be sure to use non-automated trading until you are confident in the system's performance and consistency. It takes a long time to develop a successful trading system, and before you perfect it, you may have to endure some live trading losses to detect glitches: back testing cannot perfectly represent live market conditions, and paper trading can be inaccurate. If your system loses money, go back to the drawing board and see where it went wrong (see step 5).

Conclusion
These six steps give you an overview of the entire process of building a trading system. In the next section, we will build upon this knowledge and take a more in-depth look at troubleshooting and modification.

Next: Trading Systems: Troubleshooting And Optimization

ไม่มีความคิดเห็น:

แสดงความคิดเห็น