From theory back to reality. Let’s check how our trading system LUXOR behaves when changing its two input parameters, including trading costs of $30 slippage and commissions per round turn. We want to see how the results of our trend-following system change when the lengths of the fast and slow moving averages are varied. We change the two averages in a wide range, the fast moving average length from 1 bar to 20 bars in steps of 1, the slow moving average length from 21 bars to 80 bars, also in steps of 1. A fast PC computes the necessary 1200 system tests in about three minutes.
From these tests you can plot the total net profit as a function of the two varied input parameters. You can do this for each input parameter separately (as shown in Figure 3.4) but you can even do this for two system parameters in the same three-dimensional area graph (Figure 3.5). Like this you get a surface in three dimensions which show you how the input parameters affect the result of your system. With special software you can even turn this graph in every direction and look at it from different sides. Figures 3.5A and 3.5B are showing the same facts from different views. Figure 3.5A is showing the total net profit as a function of the two moving average lengths from the side, and Figure 3.5B shows the same optimisation result from above. From these two figures you see that the trading system has been profitable in a wide range of input parameter settings (dark blue areas) but has also produced losses or only small profits in other ranges of parameter settings (yellow, green and light blue areas).
Figure 3.5: Three-dimensional area diagrams for all trades of the system LUXOR. a) side view, b) top view. Net profit in US dollars as a function of the two input parameters: fast and slow moving average. Tested on British pound/US dollar (FOREX), 30 minute bars, 21/10/2002-4/7/2008, incl. $30 S+C per RT. Diagrams generated with RINA 3D Smart View.
52
Trading Systems
A
B
Of course we are looking for input parameters which produced a high net profit in the past. But as shown above in Figure 3.4 it is even more important for those system parameters that they have enough peer parameters in their near neighbourhood which were nearly as profitable as the chosen “best” ones. In our trading system which we have developed, so far the whole area in the lower right part (Figure 3.5B) seems at a first glance to fulfil this requirement. We’ll now take this shorter area and have a closer look on it (Figures 3.6A-D). From these graphs you can see that the system stays very stable against parameter variation in the chosen area. Although the total net profit varies in a relatively big range (between $20,000 and $100,000) it stays clearly positive for all selected input parameters. The best profits of nearly $100,000 are achieved in the region when the fast moving average is very small (< 3) and the slow moving average is between 30-50. This is also the area with the smallest maximum intraday drawdowns of about
$15,000. Over all parameters the maximum intraday drawdown does vary quite a lot but never becomes excessive – it always stays below about $35,000.
Like the total net profit and the maximum intraday drawdown you can plot further important statistical figures as a function of the two input parameters (Figures 3.6C and D). If you do so you get further valuable insight into your trading system. If you watch, for example, the total number of trades of the system (Figure 3.6D) you can see a fact which holds true for many trend following systems: the slower you make them to react (in our case the longer the look-back periods of the two moving averages are) the less trades you get. By changing the input parameters of the system you have the possibility of affecting some key attributes which allows you to adapt a system better to your trading style or to the requirements of a money management scheme in a bigger portfolio. Let’s say you have many fast-reacting systems in your portfolio and need more slow-reacting components – you may achieve this by choosing longer look-back periods for the moving averages. If you need a faster-reacting system you make the input parameters smaller.
We’ll come back to this observation in our portfolio building section when correlations between different trading systems and their different time scales become important.
Interestingly, in our trading system, while the number of trades changes a lot with the system’s input parameters, another trading figure, the average profit per trade, stays relatively stable (Figure 3.6C). It varies between $10 and $50 but mostly stays between $30 and $40, especially for all fast moving averages between 1 and 9 and the slower averages between 30 and 50.
From these results you can conclude that “good” system parameters will be an
How to develop a trading system step-by-step – using the example of the British pound/US dollar pair
30 and 50. Let’s take the value “1” as input value for the fast moving average. It is clear that a one period moving average is not a real moving average, even if for the sake of simplicity we keep calling it a moving average. In fact the fast moving average becomes the closing price itself. For the slower average you can take any value between 30 and 50. We choose here 44 as an input value since it produces the highest total net profit and has a wide neighbourhood of profitable parameters.
Of course you should always observe the behaviour of your system in the following months and if it turns out after a longer period of screening that the chosen parameters (1/44) are not the most stable choice then you must change them, for example to 3/30 (if these parameters proved to be more stable than your initial choice of 1/44). Such a parameter change is an example of a reoptimisation. You will find a more systematic approach to the topic of periodic reoptimisation and walk forward optimisation in Chapter 6. For the moment we stay with the parameters of 1 (fast moving average) and 44 (slow moving average) and we will take a closer look at the trading system’s performance.
Figure 3.6: Three-dimensional area diagrams for all trades of the trading system LUXOR. Main system figures as a function of the two input parameters: fast and slow moving average.
Tested on British pound/US dollar (FOREX), 30 minute bars, 21/10/2002-4/7/2008, including
$30 S+C per RT. A: net profit B: maximum intraday drawdown C: average trade net profit D:
number of total trades generated. Diagrams generated with RINA 3D Smart View.
A
54
Trading Systems
How to develop a trading system step-by-step – using the example of the British pound/US dollar pair