Wednesday, November 24, 2010

Dual Moving Averages ... the Market's Favorite…

Why moving averages are my least favored trading tool

"What moving averages do you use?"

Isn't that a common question? Is there and answer? Of course, many traders use moving averages. Which are the best periods to use then?

My answer: "Depends on how much money you want to lose."

I am fascinated by the market's fascination with moving averages. Why? Am I missing something? I have seen all sorts of strategies using moving averages but have never seen a strategy that is stable and makes steady profit with a low drawdown.

Let's take a look at a simple dual moving average strategy that simply buys when they cross higher and sells when they cross lower. I used this on a chart of the Euro against the Dollar and to begin with I have limited this to a period of five years from the introduction of the Euro in January 1999.

Just to speed up the process I optimized the two periods which ended up as 9 periods for the short moving average and 35 for the long moving average.

Capital $20,000 Leverage 5x EUR 80,000
Total Net Profit 0.4918 Gross Profit 0.8088


Gross Loss (0.3170)
Total # of trades 38 Percent profitable 55.26%
Number winning trades 21 Number losing trades 17
Max intraday drawdown (0.0908) As a % of capital (36.32%)
Largest winning trade 0.1046 Largest losing trade (0.0442)
Average winning trade 0.0385 Average losing trade (0.0186)
Ratio avg win/avg loss 2.0654

1999 0.0983 39.32%
2000 0.1355 54.20%
2001 0.0396 15.84%
2002 0.0759 30.36%
2003 0.1425 57.00%
TOTAL 0.4918 196.72%

Let's look at these numbers.

First of all I took an average rate of 1.25 for the EURUSD rate and came to a position size on a 5x leverage of EUR 80,000. This is probably a bit high, but for the sake of examining just how good a strategy is it will suffice.

Well, we have see 55.26% of the trades make profit and the ratio of profit to loss is over 2:1. That is quite good. The total net profit over the 5 years is 0.4918 – so very nearly 0.1000 per annum. Looking at the results for each year we see the lowest return was 15.84% (2001) and the highest was 57.00% (2003). I'd be happy with that. We've almost trebled our capital in that time although we would have had to have gone through something like a 36.32% drawdown in capital at some point.

These numbers are good!

So on the 1st January 2004 we can start trading… and these would have been the results since then:

Capital $20,000 Leverage 5x EUR 80,000
Total Net Profit (0.0922) Gross Profit 0.2704


Gross Loss (0.3626)
Total # of trades 27 Percent profitable 22.22%
Number winning trades 6 Number losing trades 21
Max intraday drawdown (0.1480) As a % of capital (59.20%)
Largest winning trade 0.0889 Largest losing trade (0.0379)
Average winning trade 0.0451 Average losing trade (0.0173)
Ratio avg win/avg loss 2.6100

2004 (0.0073) (2.92%)
2005 (0.0416) (16.64%)
2006 (0.0128) (5.12%)
2007 (0.0130) (5.20%)
TOTAL (0.0747) (29.88%)

Suddenly the numbers don't look quite so good… Every year has recorded a loss and the maximum drawdown was almost 60% of capital. Only 6 out of the 27 trades made profit over the 3.25 years.

Was there something wrong with the optimization? How could the same moving average periods lose so much money?

I have news… this is very, very common.

The next question is normally "Can I add a money management stop, trailing stop or take profit."

Of course you can but do remember there are two risks involved. To be honest a money management stop should always be employed. However, there can be a downside in that when set to a level with which you feel comfortable it can actually increase the drawdown. What can happen especially with simple moving average systems is that since they provide a lagging entry signal, the subsequent pullback is so deep it will catch the money management stop. This often takes a loss on a position you may have profited from without the stop and if there are too many of these it can actually cause the drawdown much higher.

Trailing Stops and Take Profit Stops are also valid methods to take more control over positions. Here however you will need to avoid optimizing them. If anything they should be set to a non-fixed amounts but reflect market volatility through using volatility. Optimizing these is not recommended. The more variables you put into your system the more unstable it becomes.

The final question is then usually asked. "Is there any way to more thoroughly check whether the optimization has provided a stable result?"

The answer is most definitely yes. Look at the profit results of all the optimized periods. For example, let's look at the strategy above. After optimization the moving average periods used were 9 and 35. Each of these should be examined to observe how stable the results are around the optimum period. Look at the following graphs of results:

On the left are the results of all lengths in the short moving average period from 5 to 12 while on the right are the results of all lengths in the long moving average period from 30 to 40.

Note on the left that around the optimum 9 period average the next best results are around 1,000 points lower and going out to the extremes these move down to 2,000 points lower. Equally, on the right we see a similar result.

It must be understood that when optimizing the chances of seeing profits as high as suggested by the optimum periods are very, very low and thus do not even begin to think that your trading results will be any where close. The best type of result you should be looking for in a type of flat bell curve which sees limited reductions in profit either side of the optimum. Even then, the more variable parameters you utilize the more chance there is of these causing an exponential reduction in profitability in your strategy.

What I have pointed out here with two moving averages is common of a poor strategy but very common using moving averages. They are really not good trading tools.

Sunday, November 14, 2010

Moving Averages as a Forecasting Indicator

There is reason for caution when analysts tell you that moving averages forecast price movement

Many analysts still claim that moving averages can be used to forecast the subsequent day's movement. I'm not sure why this is considered true as none of the tests I have ever done suggest that they are anything less than poor at the role. In fact, almost certainly they would lose money when used in this fashion.

Let me go through a test to highlight the numbers and the risk of loss.

The first test is a simple trading strategy. If the moving average closes higher then the strategy will buy at the next day's opening price and exit at close. In fact, just to try and discover the best parameter for Dollar-Yen I optimized the period used on a daily chart over 5 years from 2002 to 2006 and fount the very best period was a 7 day exponential moving average. The results can be summarized as follows:

Year Profit (in points)
2002: 1,299
2003: (664)
2004: 1,775
2005: (224)
2006: (840)

Total: 2,568

Maximum drawdown: 1,343 points (maximum loss from the equity high point)
% of winning trades: 50.89%
Average Profit: 50 points
Average Loss: 48 points
Ratio of profit/loss: 1 : 1.04

Let's just look at the numbers. First of all the net total over 5 years represents about 500 points a year. If we use a conservative 5x leverage it will represent an approximate 22.5% return a year on average. Not too shabby.

Now let's look at the maximum drawdown, a massive 1,343 points which using the same leverage would have lost you 61% of your capital and would have severely restricted your ability to trade at the same leverage, not even to mention whether you would have just plain given up.

Let's look at something more damning. By necessity chart prices are constructed using the bid price only and thus you should always look at allowing for the 3 point spread. Let me add in a 3 point slippage. The figures now look like this:

Year Profit (in points)
2002: 537
2003: (1,435)
2004: 992
2005: (553)
2006: (840)

Total: (1,299)

Maximum drawdown: 2,181 points (maximum loss from the equity high point)
% of winning trades: 48.25%
Average Profit: 50 points
Average Loss: 48 points
Ratio of profit/loss: 1 : 1.03

Clearly in reality we would have probably made a loss just because of the bid/offer spread! What is more, the maximum drawdown of 2,181 points would have implied a loss of 99% of our capital!

I think that clearly shows that moving averages simply do not forecast the next day's movements. However, in addition to the above the results shown are from using the optimized period. In reality we wouldn't know the optimum period until after the fact and would have to hope that the period chosen would continue to make the same level of profits. I have met many traders who think this is a reasonable assumption.

Well, to dispel any such ideas let me show you the graph of the profit/loss across the range of optimization periods which I organized from 3 to 30:

Out of 28 periods used only 9 actually produced profit. The 7 period average made the most at 2,568 points (before allowing for the spread) while the next best profit was the 6 period average which only made 1,620 points. When allowing for the spread no period of moving average made any profit at all.

I hope this puts to rest the claim that moving averages can be used to forecast price.

Thursday, November 4, 2010

Using Support and Resistance Levels

A guide to determining approximate reversal levels

Support and resistance is a tool which is often used but quite often the source of the support and resistance levels are not often completely obvious. There are several ways to derive these levels:

  1. Previous support remains supportive until broken and vice versa
  2. Previous support becomes resistance and vice versa in pivot levels
  3. Fibonacci derived support and resistance either by retracement or projections

The third method is the most accurate but the process of learning how to calculate these using the right levels requires a large degree of experience and skill using Elliott Wave. I shall therefore concentrate on the first two in this article.

In the image above the upper chart is of daily Dollar-Yen while the lower is the weekly chart.

Now the first thing to remember is that trends are developed when (in an uptrend) highs are moving higher and lows are moving higher. In a downtrend the lows are moving lower while the highs are also moving lower.

Thus when in an uptrend the most recent low is broken we need to decide where price might finally make a corrective low.

For example, we can see in the daily chart that price rallies to the 121.38 high at point (1). It then reverses, breaking below previous lows in the uptrend. So now we know the uptrend is reversed but where will the decline reach?

In the weekly chart we can see two prior lows around 115.50 which also provided resistance in an earlier correction. It is this pivot area where the first decline to point (a) completes. The correction to point (b) can often be measured by Fibonacci retracements and in the case it was 76.4%.

The next decline in the daily chart to point (2) reaches 108.96. This is just 26 points above the last major low at 108.70 before the rally to 121.38. It is very frequent that the first retracement will move to the most recent major low (after a rally) or the most recent high (in a decline). A horizontal line has been marked on the weekly chart to show this support area.

Now that we have identified the approximate area of the low and we see a recovery we can begin to look at where this may reach. We should remember the pivot area around 115.50 although while it did see a reaction for a few days price quickly broke through and we then need to look for the next resistance.

Here is a little tip that can be useful. Where you see a very distinctive 3-leg move as we did from the 121.38 high down to 108.96, the retracement will quite often move to the extreme of the middle correction - in this case at point (b). The high was at 119.38 and the rally to Point (c) ended at 119.87 - just 50 points above.

From the 119.87 peak we can see how price then declined and penetrated the series of supporting lows so we then look at the 115.50 pivot area again but since this didn't hold too well on the way up we can begin to look at the series of lows that spread across from the 113.41 low at Point (a) and the last major low which was at 113.95. We should expect the correction lower to find a correction close to the 113.41-95 area. In the end the correction ended at 114.42 at Point (3).

The next rally then moves up to retest and break the 121.38 high at Point (4). We may have been tempted to call price higher then but the break below the corrective lows signaled a reversal lower which has been declining back towards the 113.41-114.41 lows and still may just get there.

Of course, using support and resistance areas in this way is an approximation and it should not be expected to find accurate or final support or resistance levels but can be useful in determining the basic direction. Certainly as price approaches these levels you should always be looking at the lower time-frame chart to spot reversal patterns or breaks of short time-frame trend lines and also of the most recent lows/highs that would indicate a reversal.

Sunday, October 24, 2010

Percent R ... Just What is it?

A deeper look at Percent R

Have you ever scanned through the list of indicators to see whether there is anything interesting that you think you can use? Did you input Percent R? Maybe you thought it was useful, perhaps not. Did it remind you of anything? It looks similar to Fast Stochastics possibly…

Just for a look I have inserted both Fast Stochastics (above in blue) and Percent R (below in red). They do seem to have similarities and certainly a similar reaction in timing but the scaling for Percent R is negative while that of Fast Stochastics is positive.

Actually they are the same.

Let us just look at the formula for each:

Fast K = 100 * ( Close - Lowest Low ) / ( Highest High - Lowest Low )

% R = -100 * ( Highest High - Close ) / ( Highest High - Lowest Low )

Quite clearly they are measuring the same relationship between the position of the close within the range of the chosen number of recent bars. The difference between the two is that Stochastics measures the position of the close from the highest high in the range while %R measures the close from the lowest low in the range.

You will also see from the formula of %R that the result is multiplied by -100 and this results in a scale of zero to -100 while Stochastics has a scale from zero to +100. Then why is there a difference between the two in Dealbook? That is because the default period used in Stochastics is 8 while %R uses 14.

What I did was change the %R calculation to use +100 as the multiplying factor to arrange the results in a scale from zero to 100. I then used a period of 14 for both indicators and then plotted them in the same chart:

Now you can see that the two are in fact identical. Why does %R provide an alternative method of displaying the same information? To be honest I really don’t know why and since they are exactly the same I personally do not use %R and if I want to use this type of momentum indicator I apply Stochastics.

Percent R ... Just What is it?

A deeper look at Percent R

Have you ever scanned through the list of indicators to see whether there is anything interesting that you think you can use? Did you input Percent R? Maybe you thought it was useful, perhaps not. Did it remind you of anything? It looks similar to Fast Stochastics possibly…

Just for a look I have inserted both Fast Stochastics (above in blue) and Percent R (below in red). They do seem to have similarities and certainly a similar reaction in timing but the scaling for Percent R is negative while that of Fast Stochastics is positive.

Actually they are the same.

Let us just look at the formula for each:

Fast K = 100 * ( Close - Lowest Low ) / ( Highest High - Lowest Low )

% R = -100 * ( Highest High - Close ) / ( Highest High - Lowest Low )

Quite clearly they are measuring the same relationship between the position of the close within the range of the chosen number of recent bars. The difference between the two is that Stochastics measures the position of the close from the highest high in the range while %R measures the close from the lowest low in the range.

You will also see from the formula of %R that the result is multiplied by -100 and this results in a scale of zero to -100 while Stochastics has a scale from zero to +100. Then why is there a difference between the two in Dealbook? That is because the default period used in Stochastics is 8 while %R uses 14.

What I did was change the %R calculation to use +100 as the multiplying factor to arrange the results in a scale from zero to 100. I then used a period of 14 for both indicators and then plotted them in the same chart:

Now you can see that the two are in fact identical. Why does %R provide an alternative method of displaying the same information? To be honest I really don’t know why and since they are exactly the same I personally do not use %R and if I want to use this type of momentum indicator I apply Stochastics.

Thursday, October 14, 2010

Things to Watch for... MACD

Avoiding the pitfalls of using MACD in your trading

MACD is used quite widely among traders mainly, it would seem, because the basis for the indicator is something they can visualize - effectively measuring the degree of convergence or divergence of two exponential moving averages. Commonly traders will consider buying or selling on crossover of the MACD lines. However, there can be problems and it is worth understanding when these may occur.

Let us take a look at the MACD plot on a weekly chart of USDJPY:

Broadly we would be pleased with the general signals being generated from MACD in this chart. While the crossover of the MACD across the signal line never really occur at market extremes, in this case they are pretty close and one cannot expect a lagging indicator to provide signals at price extremes.

It can be seen that before the moving averages cross the MACD is signaling a reversal earlier and allowing an early entry into a potential trade. Perfect. We can begin to trade on this indicator then… Or can we..?

Take a look at the second chart, still the weekly chart of USDJPY but from a year or two later:

At first it looks quite good. MACD signals a sale into the large decline to the historic 79.70 low and a little later a reversal higher. There is lots of profit to be taken there. However, watch as the MACD peaks out soon after the initial rally from the 79.70 low. The two exponential moving averages continue to point higher and indeed do not cross lower until after the 147.65 peak. However, MACD spends around one year in a decline while price has continued to rally.

This is a recipe for losses.

Why is it that MACD can provide such a bad signal since it is based on two exponential moving averages?

The answer lies in the name: Moving Average Convergence and Divergence.

While the exponential moving averages are rising, the trend has slowed to the point that while only slightly the averages are converging - that is, moving closer together and this has caused the MACD to cross below the signal line.

Well, is there any way to control the trades to make sure that we do not make those trades? Indeed. One of the best tips I can offer is to remember the definition of a trend. An uptrend is where both highs and lows are moving higher. Thus, until the most recent low s broken there is no break/reversal of the trend.

Let us look at how this would have worked:

As can be seen, I have drawn a horizontal line under each successive swing low. At no point is one of these broken until after the final high to the upper right of the chart. Thus, by combining information garnered from the price chart you can avoid many loss making trades.

Monday, October 4, 2010

Head & Shoulders

The EURUSD (1-Hour Chart) has now established what appears to be a classic "Head and Shoulders" pattern over the course of the past few weeks. This pattern is essentially a 'triple top' pattern, where the center top (Head) stands higher than the first or third tops (Shoulders). The rational occurs as the result that the market was not able to revisit recent high prices established during the center top, and therefore is inherently a sign of an imminent reversal to come. Typically, to complete the head and shoulders pattern, we must wait for the market to break below the lows established during this triple top patter; (neckline). However in regards to placing the actual trade, it is in our best interest to sell-short the market as it tests and fails to break above the highs of the 2nd shoulder, while placing protective stops above the highs of the shoulders and perhaps the highs of the center top (head). By doing so, this trade can provide us with a favorable risk to reward scenario if the market does in fact breakdown below our horizontal support line to new low's.