## Adding a trailing stop

A trailing stop is a stop order which adapts to the current market price. In the case of a new long position it is initially set at a fixed percentage below the entry price. If the market price rises, the trailing stop price rises proportionately, but if the price falls, the trailing stop price doesn't change (Figure 3.15A). Figure 3.15A The principle of a trailing stop. Chart example from British pound US dollar (FOREX), 30 minute bars, September 2008. Chart from TradeStation 8. Figure 3.15A...

## Percentage of profitable trades

The percent profitable trades number expresses the number of winning trades out of the number of the total trades. It is important not by itself (a trend following system can have a low percent profitable trades number such as 35 and still be a viable system) but because it can be used to gauge how the system is balanced in relation to the average winning trade average losing trade ratio. Usually the logic is that if you win a lot of times the average winning trade average losing trade ratio...

## The birth of a trading system

As mentioned in the introduction there are lots of sources for developing your own pool of trading systems. One of them is certainly the Strategy Trading and Development Club (in short STAD) of Omega Research (TradeStation). As a starting point we take the following entry logic, as explained in STAD, volume 13 The Luxor system identifies set-ups for new trades by the crossing of two moving averages - a fast one and a slow one. Of course, there are many types of moving averages Luxor is the...

## Limitations of the Monte Carlo method

If you want to estimate the real risks which are hidden below the results of your performance table, Monte Carlo analysis is the right method. But when drawing conclusions from Monte Carlo calculations you still must keep in mind the assumptions on which they are based and their limitations. The dangerous point is that for the Monte Carlo analysis you take the trades from the trading logic as you get them from your backtests. But what if this trading logic is only curve fitted and...

## Predictive power of the different polynomials

Let's see what happens if we add further data points by letting the sinus function continue into the future (Figure 5.18). You can see that the polynomial of degree 0 continues to go sideways with the sinus function. Thus the predictive power of this very simple function for the future is quite poor, but it is worth mentioning that it stays exactly the same as the result of the back-test of the ten data points. Table 5.4 Average error of fit to data points (standard deviation) as a function of...

## Interpolating data points with polynomial functions

You have just seen how a trading system's predictive power for the future changes with the number of rules which are involved in the strategy. In our system these rules have been the fast and slow moving average, the very effective intraday time filter and finally the three exits we added. You have seen that a simpler trading system has more predictive power than a more optimised one. We can state that this result was not just gained by accident but it is well founded on statistical rules. We...

## Correlation among equity lines

As we have seen, this is one of the sacred topics of portfolio trading look for those markets that are negatively correlated and trade them. In this way you can smooth the resulting portfolio equity line. The premise of this approach is always that you need to have the same system, set with the same inputs, on all the markets. If you trade a trend-following system and a counter-trend system the logic would require you to trade the same market in order to be sure that, whether it is trendy or...

## Reasons for the outofsample deterioration

We suggest the following reasons and discuss their possible contribution A The trading logic generates less than 100 trades, therefore the results are not statistically significant. We conducted the same experiment with the same trading system on a 30 minute basis. There the system generated 3000 trades in the training period and got a similar out-of-sample deterioration. So although 69 trades of the daily system are not enough to be statistically significant, the results shown here are typical...

## How exits are affected by money management

The risk and money management of a trading system or of a whole portfolio of systems and markets can never be separated completely. The two components are highly dependent on each other. Therefore it is essential that your money management strategy is integrated into an overall approach to system design and development. Money management does not exist in a vacuum but is based on proper pre-calculated exits within your applied risk management schemes for every single trading system. In this...

## Result with added time filter

The detailed equity curve of our trading system seems not to have changed a lot because of the added time filter (Figure 3.9A). Instead, a look at the underwater equity curve reveals that the drawdowns within the 5 years of trading have increased from 8 before to 10 with the daytime filter. Furthermore, it now takes longer for our modified trading system to recover from these drawdowns. So what have we gained from our filter You can evaluate the time filter impact with a closer look at the...

## The concept of Maximum Adverse Excursion MAE

In order to find proper stop points for your system you should take a deeper look into the distribution of trades and examine each trade individually. When you do so, you will discover that there are similarities between them, but that every trade also has its own set of characteristics. These characteristics can be examined by using the Maximum Adverse Excursion MAE technique developed by John Sweeney less than ten years ago 9 . MAE is defined as the most intraday price movement against your...

## Introduction to portfolio construction

Even if many traders are aware of the notion that trading a portfolio of multiple systems on the same asset, or the same system on multiple assets, or both, smooths the overall equity line, few traders test and optimise a system with this perspective in mind. One motive for this in the past may have been that the most common technical analysis packages did not allow traders to produce a portfolio equity line easily. Nowadays things have changed and many software houses offer products that allow...

## Performing a Monte Carlo analysis with the LUXOR trading system

Let's look at the concrete example of a Monte Carlo analysis of our trading system LUXOR Table 4.1 . Table 4.1 Monte Carlo analysis of 5000 permutations with worst case maximum drawdown and average drawdown as a function of confidence level. Trend-following system LUXOR British pound US dollar FOREX , 30 minute bars, 21 10 2002-4 7 2008. Calculation based on one contract basis, results including 30 slippage and commissions per trade. Calculation performed with Market System Analyzer. Table 4.1...

## Calculation without slippage and commissions

The strategy is now applied to 30 minute FOREX data from 21 10 2002 to 4 7 2008. All the following calculations in this chapter are based on a one contract basis. Keeping the beginning simple we calculate the trading system's results without any slippage and commissions. These will be added in the next section where we will examine their impact on system performance. Furthermore please note that at first we check the system just with entries and trade reversals, leaving out exits. As first...

## Dynamic portfolio composition the walk forward analysis activator

It was developed by Fabrizio Bocca and Cristiano Raco, two brilliant Italian systematic traders, and has not been disclosed so far. Let's look at an example on an intraday trading system which is put under periodic optimisation every 3-months inside a process of walk forward analysis. If during the 3 month periodic re-optimisation the system has a walk forward efficiency ratio of more than 50 then it is traded in real time and conversely if the walk forward...

## The meaning of sample size and market structure

One point which is relevant during every optimisation process and especially of periodic re-optimisation is the question of how to choose your optimisation period. Do you reoptimise every day, every two weeks or every year Your computer, with its limited power, may give an answer to this question but there are still other points there to investigate, one of which is the market's inherent attributes, which we call market structure. In our LUXOR system we had a rolling optimisation period of one...

## Finding the best entry time

We now perform system tests in the following way. We take our LUXOR entry but we restrict the entry times to a short 4-hour time window every day. We will shift the starting time of the window in steps of 30 minutes throughout the day in order to find the best window. For the Easy Language Programmers you have to add some lines into the LUXOR-code as shown above, Text 3.1, point 2, Time Window Filter. 3 Time investigations are valuable for many other markets. Some of you might have read our...

## Drawdown

A broad definition of drawdown could be the largest loss or the largest losing streak of a trading system, whichever is the biggest 4 . In a more graphical way we can depict drawdown as the dip in the equity line between a highest high point and the successive lower point before a new high is made. In other words total equity drawdown is the open trade profits and losses plus the already closed out equity on your account. But drawdown has more subtle meanings according to whether we consider...

## Bollinger Band system with logic and code

We will stay with the pound dollar FOREX market from 2002-2008 Datafeed TradeStation 8 to test the system. We take a Bollinger Band system Figure 5.4 and optimise all its main six input parameters for the entry and exit points on daily data within the training period between 30 04 2002 and 1 3 2006 Figure 5.3 . Please note that this Bollinger Band system allows a different optimisation of its input parameters concerning the long and the short side. For the upper and the lower Bollinger Band the...

## Inserting a risk stop loss

In the MAE diagram you can see how all trades behaved and if there are any special points to consider when looking for a good place to set a proper risk stop loss. The MAE diagram can give you a hint that the optimal stop value is somewhere between 0.2 and 1 . However MAE does not tell you directly what the optimal value is to set this stop. For this reason we now look at the task from a different side by performing system tests in the following way. We add a risk stop loss into our trading...

## Dependency of main system figures on the two moving averages

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...

## LUXOR tested on different bar compressions

It is fascinating to check how a trading strategy changes on different timescales regarding its important system figures and equity lines. Let's do such a timescale analysis for the LUXOR trading system. As you remember LUXOR was developed on 30 minute data of the British pound US dollar FOREX market. Let's have a look at the equity lines on different timescales Figure 4.2 . You see from these curves that our developed system logic gains steady profits on all the different timescales, starting...

## Walk forward analysis

In conclusion we can state that optimisation is something variable in terms of data window since systems need to be kept in synchronisation with the market. Before computer power became so cheap and easy to employ for the majority of market players, an out-of-sample period was always recommended after optimisation by all the trading systems' developers. The out-of-sample period is a data window usually 10 to 20 of the whole optimisation data window we keep outside the optimisation process and...