Welcome to MarketPulse, Australia’s most insightful look into the markets and trading!
Over the last few MarketPulse articles, we have discussed the various steps which traders need to go through to design a robust trading system. For those who may have missed those articles, a trading system contains a series of conditions which need to be met before we enter a trade. When these conditions are met we are said to have a ‘setup’. Setups are an integral part of our trading plans and are essential to improving our consistency and performance in the markets.
This week we will put into practice the trading system we designed in the previous article. To recap, the trading system involved:
Long term trading system
Before a long entry can be considered, the 100 day moving average must be at its greatest level in the last 20 periods, and the last closing price must be above the 100 day moving average.
Buy when the 20 period ma crosses above the 40 period ma, or if a cross up has occurred within the last 40 days, then the 20 day ma must still be above the 40 day ma.
Holding and Exit Rules
Initial stop loss is to be placed 2.5% below the 40 day moving average.
Stop is to be trailed higher each day to 2.5% below the 40 day moving average at the conclusion of each trading session.
Back to the future
We are going to take the approach most professional traders will use when testing a system and run a ‘back test’. A back test is a simulation of how a trading system performed on historical data.
To run a back test we need to choose a sample of data and record in meticulous detail each entry and exit for the system based upon its explicit rules. We then sum the results of many trades over an extended period of time to get an idea of how effective a system has been in the past.
Learn How to Run a Backtest
Attend a FREE Workshop Near You.
Click here to reserve your seat now.
For this back test we are going to use a security which has been in the news quite a lot of late, the Australian Dollar versus the US dollar (AUDUSD). Of course, one could back test on any asset which has a history of prices, so you may wish to further the research on this system and test over your favourite stocks or commodities.
The period of time we test over should be far from random. If we are going to design a system, then preferably the system works over all types of market conditions (rising markets, falling markets, sideways markets and variations thereof). This article is not meant to be a comprehensive tutorial on back testing, but I will make one important point on this topic here: We must choose a period to test which contains each of the various market conditions in the past.
To highlight the importance of this item, consider if we chose to test over a period of data which happened to only contain strongly rising prices. If we discover our system works very well, it is highly likely that the system will work only in a similarly strong market into the future. If the market into the future is not as it was in the sample testing period, we are likely to experience significant losses. Similarly, we may find the system failed miserably in testing over this sample, yet worked very well in the ensuing bear market. In summary, if we wish to obtain a system which is robust over multiple market conditions, we therefore need to test over multiple market conditions.
Secondly, (and again briefly here because the topic of back testing is a vast one) it is also important not to run a test up to the current day. We should select a period of time in the past which contains multiple market conditions, and then a similarly diverse period of time subsequent to this period to conduct further testing on. This is because we can test the strategy on the initial period, optimise any parameters to improve its performance, and then test the optimised system on the second, most recent sample.
This is called ‘out of sample’ testing and is far preferable to simply testing up to the current date and then taking the system ‘live’. In each case, the system will be tested on data it hasn’t seen before, however in the latter, we have no risk of losing our shirts during the testing process! Testing on out of sample data invariably leads to a more robust trading strategy and better real life results.
Taking all of the above into consideration, we will select the period of time from December 1998 to December 2007 to do our initial testing (see below).
We can see from the price data above that the AUDUSD has moved in all manner of trends over the sample period. Importantly, the period of time subsequent to this and up to today (on which we can eventually conduct our out of sample trading) has a similar variety of price trend conditions.
For our system we will assume that an entry (green arrows) is only made when each one of our official entry conditions are satisfied. As this system is based upon end of day data, a setup is only confirmed at the conclusion of a trading day. This means that when a signal occurs, we may only enter a trade on the open of the next trading day (we will use the open price in our results). We will also assume that upon entry we immediately placed our stop loss 2.5% below the 40 day ma and then trailed it dutifully in this fashion each day (exits are red arrows).
Learn to Identify Trading Signals
Attend a FREE Workshop.
Click here to reserve your seat now.
This is a long only system (we never go short), and we only traded in one contract at a time, not increasing our position even if subsequent buy signals to our original were encountered. By the way, anywhere we refer to ‘days’ in this example, we mean trading days – not calendar days. Finally, as our stops are automatic, we assume that they were triggered in real time. For simplicity, there are also no commission costs, financing, or slippage in our example (this is the reason why we chose to test over an FX pair as these are typically very small anyway).
When we overlay our trading system on the AUDUSD Spot, we get the following series of entry and exit points over a 9-year period.
Our simple moving averages system allowed us to make 2,264 pips profit. On one standard contract, which is worth US$10 per point, this would amount to US$22,640 profit over 9 years. This is an annual return of approximately $2,500 on an investment of approximately $500 margin for one standard contract. Better than a poke in the eye – yes, but it’s fair enough to say it’s not enough to retire on!
Note that our strike rate was less than 50% and our system was still very profitable. This is because our average win size was nearly three times greater than our average loss size. Our average profit or loss per trade was a profit of 174 pips. Again we have to emphasise that strike rate is not all that important in building a good trading system. It’s how much you can expect to make on each trade, and overall, in the long run that really counts.
That’s all we have time for in this week’s MarketPulse. For now it is important to note two things:
Firstly, that just because a system made zillions of dollars over the last 50 years, it doesn’t mean it will make a cent in the next 50 minutes! All we can do is take our back testing with a pinch of salt and understand that in the future anything can happen.
Secondly, the system we have outlined here is a very basic system and has a very long way to go before it is actually tradeable. I.e. read between the lines here: these articles do not constitute a recommendation to trade this system! It’s just an example, and one which we will expand on next week.
Until then, happy systems testing!
Written by: marketpulse Other posts from: marketpulse
Posted in Market Pulse
No Comments »