Sunday, June 8, 2008

Filtering Trades by Moving Averages

Most people who trade breakouts realize that there are times and market conditions where breakouts work fantastically well and times when they just don’t. Furthermore, these periods where breakouts have a high tendency to fail is often what constitutes a large percentage of the drawdowns and frustration associated with them. A technique for reducing profit targets, tightening stops, or simply staying out of the market all-together would be a huge benefit in improving the overall performance characteristics of these types of systems.

Pradeep Bonde of Stockbee has his Market Monitor which in my experience, has done a fantastic job recently of giving the all-clear sign for breakout and momentum based trading strategies but this is a proprietary indicator and one that is difficult to backtest without archived historic data for it. There are way too many such indicators out there to test them all but I decided this week to test one of the most common and simple to implement filtering techniques, moving averages.

Everyone has there favorite so at the risk of being accused of literal curve fitting, I decided to test a wide range of them from 10 to 200 days in 10-day increments so everyone can see how there favorite holds up. To keep things simple, we only require that the close be greater than or equal to the X-day simple moving average.

In addition to filtering by the individual MA of the stock being tested, I also looked at filtering by the MA of a corresponding broader index. For those tests, we use an independent data series; NDX for the Nasdaq portfolio, SPX for the S&P portfolio, and RUT for the IBD portfolio, and require that these broader index's close is greater than or equal to the X-day simple moving average before taking the trade.

As usual, we will run the test on three separate portfolios to increase our confidence that the results are systemic and all tests will be run from 01/01/1998-12/31/2007. Other than the addition of these moving averages, the entries and exits are identical to the ones used in the past several weeks:

Setup:
10-day average daily volume >= 100,000 shares
Close >= X-day SMA

Entry:
200% volume increase over 10-day average daily volume
2x ATR breakout (Close >= Yesterday’s close + 10-day ATR*2)

Exit:
8% fixed protective stop (GTC stop order)
20% fixed profit target (GTC limit order)

I will post charts of all 4 of our performance ratios and then discuss the results, followed by the raw data. The heavy lines are the results of applying the MA filter to the individual stocks themselves while the thin lines represent filtering of the corresponding indexes. The results are a little surprising.

EDR=Expectancy per dollar risked. It is calculated by Average Trade/Average Loss. The results are in dollars with .60 representing 60 cents per dollar risk.




PF=Profit Factor. This ratio is derived simply by dividing gross profit by gross loss.


EER=Efficient Expectancy Ratio. This is our EDR/Avg. Days in Winning trades. This number is meant to reveal the most efficient use if capital as it calculates expectancy per dollar risk per day in trade. The results are in dollars with .01 representing 1 cent per dollar risk per day in trade.


DDR= Drawdown ratio. This number is calculated by Net Profit/Maximum Drawdown. A higher number is better.


Raw Data of MAs applied to individual stocks


Raw Data of MAs applied to corresponding indexes


Not what you were expecting? The figures highlighted in grey in the raw data charts are the results of the entries and exits without the use of a MA filter. As you can see, the addition of a MA, any MA, does tend improve things a little but any advantage one has over another, or even the advantage of using one at all is minimal at best. The Nasdaq portfolio experienced the best improvement of the three but even that one only had a 5.7% improvement in expectancy using the best-case 90-day over nothing at all. Far from convincing even if that 90-day remained the best moving forward – which it won’t.

You will also note that these results tend to be very “peaky” with relatively wide swings from one value to another and this can generally be taken as a warning sign of curve-fit results. If we had a nice smooth transition from low to high for example, I would be far more willing to conclude that “longer MAs were more effective than shorter MAs” but even that simple of a statement would be a stretch here.

It is very easy to look at a chart of a specific stock and draw the conclusion that only trading it when above some particular MA would have improved things drastically but these tests clearly highlight the flaw in that type of exercise and point out why portfolio and basket testing is important if one is truly interested in robust criteria not fit to specific market, stock, or situation.

I want to make a few points here. There are situations where I feel MAs are useful but one must carefully think through the logic behind them and other criteria of the system being tested with them. I am currently working on mean reversion system with a couple of other bloggers and the use of a MA has been very effective in that particular situation but the goals, logic and objective of the system is completely different than what we have here.

One of the unique things about the breakouts we are testing here is that unlike an N-day high breakout, for example, made famous by the turtles, these breakouts are capable of entering at the very beginning of a trend – the “bottom” if you prefer. The irony of the MAs is that the longer the average, the more reliable it is considered but the longer the lag and the more of a good trend you may miss. The use of medium to long-term MAs in this example can completely wipe out one of the key advantages of this type of entry. Our 20% profit target is also relatively modest for the magnitude of our breakout criteria which really makes this a swing-trade oriented system. If your choice of stops and corresponding time-frame for trades are different, you may or may not derive more benefit from the use of a MA than what we get in these tests. Thorough testing is the only way to know for certain.

The last point I want to make really has more to do with an approach to system development I prescribe to which is commonly referred to as KIS, or Keep It Simple. Often you see a system chocked full of so many rules, you really wonder what components are truly responsible for the majority of the results. By starting simple and layering up criteria component by component, it allows the trader or system developer to understand what each element is actually contributing to the system. Many believe, myself included, that the simpler a system is, the better it will hold up over time. If a rule isn’t doing anything to improve something, be it expectancy, draw-downs, win-rate, etc., it probably shouldn’t be there.

3 comments:

Jeff said...

Good stuff. Your discussion about the limitations/benefits is excellent.

bhh said...

Thanks Woodshedder. I knew from exploratory testing that the use of MAs do almost nothing for these breakout but figured it was probably worth writing about anyway because I've been asked about them so often.

David Varadi said...

i have a good idea........try using different MAs and bollinger bands of the VIX where you buy various standard deviations below the mean following the same breakout entry criteria--this will better simulate the concept of follow through days even when the market is in a downtrend based on MAs.....it will also probably separate out periods with limited upside