Systems on moving averages: are the “cars” still alive?
Everyone who has ever encountered trading in the financial markets knows what the Moving Average is. This classic technical indicator is so widespread that it is found in almost every trading system. Even if the strategy does not use moving averages directly, most likely you will find other indicators in it that use the average in their calculations. Today we will talk about the direct use of moving averages in trading systems, conduct tests of the most common strategies on “mashups”, and conclude whether it is worth looking in the direction of this indicator in today's markets or looking for a grail elsewhere)
You can get acquainted with the indicator itself in this article. She will introduce you to the main options for its calculation and the basics of practical application. Also in this article you can get acquainted with the whole variety of types of moving averages that have appeared with the development of technologies and, in particular, with the advent of home computers.
Moving averages are mainly used to reduce unwanted noise in time series, so that the market behavior underlying the pricing process becomes more understandable and noticeable, more clearly expressed. They provide data smoothing. As a smoothing method, the moving average is a specific low-pass filter, skipping low-frequency activity and suppressing high-frequency fast-variable processes. On the price chart, high-frequency processes look like fast vertical vibrations, that is, like noise, and low-frequency ones look like smoother trends or waves.
In addition to the ability to reduce the noise of time series, moving averages have the advantages of simplicity, visibility and functionality. However, at the same time, like any powerful method of filtering or smoothing data in real time, they have the disadvantage of delay. Although the smoothed data is cleaner and therefore more suitable for analysis, there is a lag between the data in the original series and in the smoothed data sequence. Such a delay can be a serious problem if you need a quick reaction to events, as is often important for traders.
In some cases, lag is not a problem, for example, in systems where the price line crosses the moving average - in fact, the price should be ahead of the average for such a system to work. Delay is more problematic in models where pivot points of the moving average chart or its slope are used for decision making. In such cases, lag means a delayed response, which is likely to lead to bad deals.
All moving averages smooth the time series using some kind of averaging process. The differences are only in what specific weight is assigned to each of the summation points and how well the formula adapts to changing conditions. The differences between the types of moving averages are explained by different approaches to the problem of reducing delay and increasing sensitivity.
Types of trading systems based on moving averages
Models of trading systems based on moving averages generate buy or sell signals based on the relationship between the moving average and the price or between two (or more) moving averages. There are trend-following and counter-trending models.
The most popular models follow the trend and lag behind the market. On the other hand, anti-trend models predict reversals. This does not mean that models following the market work worse than anti-trend ones. Reliable trend entries, even if lagging, are considered more reliable and profitable than attempts to predict reversals that only occasionally occur at the expected moment - there will usually be one global extremum, while there will be many local ones.
Trending methods for generating trading signals based on moving averages can be implemented in various ways. One of the simplest models is based on the intersection of moving averages - a trader buys when prices rise above the moving average, and sells when prices fall below it.
Instead of waiting for the average line and prices to cross, you can use the fast average and its intersection with the slower one. A buy signal occurs when the fast average rises above the slow, a sell signal - when the fast average falls below the slow. Smoothing the original data series through the use of moving averages reduces the number of false intersections and, therefore, reduces the frequency of unprofitable signals.
Another way to use moving averages is based on using the intersection of the moving average and the moving average shifted forward with the same parameters. In this case, a buy signal occurs when the fast initial average rises above the biased, a sell signal - when the initial average falls below the biased. By choosing the magnitude of the shifts, one can reduce the number of false intersections, reducing the frequency of unprofitable signals. Sometimes several shifted moving averages are used simultaneously with a different shift and different periods, as, for example, in B. Williams's alligator or in the Ishimoku indicator.
Moving averages can also be used to receive entry signals in anti-trend systems. Prices often respond to the moving line in much the same way as support and resistance levels, on which the entry rule is based, according to which they buy when prices go down to the moving average or cross it from top to bottom and sell when they rise to it or cross from below -up. It is assumed that prices bounce off the moving average, changing the direction of movement.
What are we testing today?
So, I plan to test several classic approaches to the use of moving averages in trading systems:
- price crossing the moving average;
- the intersection of two moving averages;
- the use of the intersection of moving averages with a shift (Alligator and Ishimoku);
- intersection of price and shifted moving average;
- work with several moving averages (three, four).
In addition to experiments with the systems themselves, we also discuss various filters and techniques that are designed to improve system performance. And, in addition to this information, I chose more than a dozen modern TS based on moving averages, which I found on various sites and forums on the network and would like to check as part of this article.
So, today we are faced with several questions that we will try to find the answer to:
- is it worth trying to create trading systems based on moving averages or is this tool hopelessly outdated?
- What are the best ways to generate trading signals based on moving averages?
- what methods of filtering the generated signals can be used and in what cases?
- Is it worth paying attention to modern trading systems that use moving averages in their basis?
- What types of moving averages are most effective and in what cases?
As you can see, a lot of questions have been posed and a very extensive study awaits us. Nevertheless, I believe that the answers to them are of interest to many traders and will be useful to both beginners and experienced traders. It should be borne in mind that this study is conducted for the Forex market - for commodity markets, commodity markets, stock markets, the answers to them can radically differ.
And, in order not to stretch this already extensive research, I selected only a few currency pairs for research, trying to choose them so that the nature of their behavior is as different as possible from each other. Moreover, these pairs should be from the group of the most popular. I chose GBPUSD, EURUSD, USDJPY, USDCAD and AUDUSD. I did not include USDCHF, as it correlates with EURUSD and NZDUSD due to correlation with the Australian. Thus, in our portfolio of currency pairs you can find traditionally trend and flat pairs, with relatively high and low volatility, with sharp and smooth movements within the day.
Intersection of price and moving average
The simplest trading strategy based on the use of moving averages is based on the use of the intersection of prices and moving averages. The basis of this TS is based on a simple trading idea: the moving average in the trending market is behind the price (due to the very principle of calculating the moving average). Therefore, it is believed that if the price is greater than its moving average, then the trend is upward, and if the price is less than the moving average, then the trend is downward. Accordingly, if the price crosses its moving average, then we can assume that the direction of the trend has changed.
Using this simple principle is the basis of the simplest trading system based on the moving average. Visually, looking at the chart, we can assume that this approach to trading is potentially able to bring us profit. Theoretically, we can get huge profits from each transaction, getting profit from most of the trend movements. There is only one question left - will not false signals, of which there may be a huge amount in flat areas, take all this profit? Verify this by testing.
The trading system will generate entry signals when the daily bar opens on one side of the moving average and closes on the opposite side. The output signal will be generated in conjunction with the opposite input signal. This type of system is called reversible - transactions will be opened constantly, upon receipt of a new signal, the current transaction will be closed and a new one will be opened in the opposite direction.
No position control like trailing stops will be used. Take profit and stop loss orders will also not be used. In automatic execution, such a system is dangerous - if the server on which the system is installed crashes, you can suffer unlimited losses. Therefore, the installation of restrictive orders (at least stop loss) in real trading is required. Well, for testing, we can neglect this rule.
In our basic trading system, only one optimized parameter is the moving average period. Here are the results of one of the optimizations:
A similar result, when most of the passes show a profit, indicates that the system is quite stable and the results are not random. The strategy is indeed profitable with most values of the optimization parameter, the model is workable, and profit is not the result of a coincidence.
Of course, the number of transactions decreases with increasing period of the moving average, but even with a high period (from 200 and above) it remains large enough (150-200 transactions) to trust the test results. Now let's take a closer look at the optimal results:
This strategy works best on GBPUSD and AUDUSD currency pairs, regardless of the type of moving average used. On the USDCAD pair, the smoothed and exponential option works better, while on EURUSD it works simple. The USDJPY pair showed low efficiency of this strategy, however, exponential and smoothed moving averages work better.
Summary statistics for a simple moving average:
Now let's try to find the suitable filters, for which we will use only a simple moving average. The most commonly mentioned filters in the literature are as follows:
- entry after 1-3 candles, if the signal has not disappeared:
In all cases, this filter significantly reduced the number of false signals and increased the final profit of the system;
- Entrance after breaking through the average and passing the price at a certain distance, depending on the current volatility (according to ATR). This distance should appear between the price and the moving average for a certain time, not exceeding the one specified in the settings:
This filter turned out to be less effective than the previous one, in addition, it filters out too many deals;
- Entrance after breaking through the moving average, built at High / Low prices:
This filter showed even less efficiency than the previous one.
Some input filters really improve the system parameters, their combinations can also give more optimal results. Nevertheless, the system is a classic trending TS in which the number of profitable trades is much less than 50%, and the size of the profitable trade exceeds the size of the losing one by five or more times. It is very difficult to trade such a system psychologically and to private traders who are used to more comfortable trading, such a system is not suitable. A typical balance chart has the form of a "ladder":
Long periods of drawdowns in combination with a small number of transactions will deliver very tangible discomfort when trading. Nevertheless, trends will always exist in the market, and, as history shows, they appear quite regularly. And this means that such a system will work and earn indefinitely, never losing its relevance. Another thing is that not every trader can withstand a drawdown lasting, say, a decade.
And finally, in the figure above you see the general statistics of the trading system using the most successful filter for entering. As you can see, it is far from perfect. In fact, the account was in drawdown between 2011 and 2015, which not every currency speculator can withstand.
The intersection of two moving averages
In the previous example, we used the simplest principle of using a moving average based trading system, taken in its pure form and with some filters for input signals. Yes, in principle it works, like most indicator methods of technical analysis, but the problems, as always, lie in the details and nuances. And one of the nuances of the considered example is the fact that such strategies work poorly in markets where there is no pronounced trend. They open many counter transactions on the “noise” price movements, while losing the profit accumulated in the trending market segments.
This drawback can be partially eliminated by using the intersection of two moving averages, one of which, faster with a shorter period, is the smoothed equivalent of the price chart, and the second, slower, is used to determine the direction of the trend. By choosing the ratio between MA periods, it is possible to reduce the number of “false” system responses due to the noise components of the price movement, as well as reduce the number of transactions in market segments with a lateral trend.
The trading idea for this case is also very simple: if the fast moving average is located above the slow MA, then the trend is upward, and if lower - downward. Accordingly, the intersection points of the fast and slow MAs are considered points of change in the direction of the trend and are used as trading signals of the system:
Now let's look at the results:
As in the previous system, the GBPUSD pair shows the best results. EURUSD also performed well. The remaining currency pairs showed approximately the same results, decently better than when crossing the MA at a price.
In general, most of the optimization results are above zero profitability, which indicates satisfactory stability of the trading system.The most profitable results for the GBPUSD pair, for example, are obtained using a fast moving average with a period from 50 to 100 and a slow moving average with a period from 110 to 180.
A lot of negative values during optimization correspond to sets of parameters where the period of the fast moving average turned out to be higher than the period of the slow one, that is, the system rules were inverse. In fact, with the right set of settings, the failed passes will be significantly less.
Modification of system rules will help to avoid this situation. Instead of directly setting the period of the fast moving average, we will set a certain coefficient in the range from 0.01 to 0.99. Then MA_fast_period = MA_coeff * MA_slow_period.
Thus, the fast moving average period will never exceed the slow moving period.
We got a very similar picture of the distribution of the results, but, this time, the number of failed passes was much less. A total of 1715 results were obtained, negative - about 30%.
This trading system assumes a more comfortable trading, periods of drawdowns are shorter. The average profitable transaction basically exceeds the average unprofitable transaction by two to three times, and the number of profitable transactions is in the region of 40-60%, depending on the currency pair. Such statistics are already more acceptable for a retail trader:
Moreover, if you collect a portfolio of at least the currency pairs I tested, the characteristics of such a system can be quite interesting from the point of view of long-term investment:
Of course, the periods of drawdowns are still quite large, but, in general, the results of the system look much better than in the previous case. Nevertheless, here we observe a very long drawdown period from 2012 to 2014, as well as from mid-2017 to today and from 2001 to 2003.
Using moving averages with shift
Another way to use moving averages is based on the use of the intersection of MA and the forward (backward) moving average with the same parameters.
In this case, a buy signal occurs when the initial MA rises above the biased moving average, and a sell signal occurs when the initial MA falls below the biased average. By choosing the shift value, the number of false intersections can be reduced, reducing the frequency of unprofitable signals.
A variant of this method is a method that uses the intersection of a price chart with a shifted MA, or a price chart with a price chart shifted forward. It should be noted that the latter option (used, by the way, in the popular Ichimoku indicator) is nothing more than another momentum indicator record. The price chart, in conjunction with moving averages moving forward, is also used in B. Williams' trading system. We will consider the option of intersecting two moving averages with and without a shift:
From the graph below it can be seen that no matter what the magnitude of the shift, the optimal period is from 90 to 150:
The negative results are again within 30%, which is quite acceptable and serves as a signal that the system is quite stable. As for the results of the system, they are not much worse than the work of two moving averages:
If we combine all tested currency pairs into one portfolio, we get the following picture:
The picture is very similar to the result of the system of intersection of two different moving averages, but the number of profitable trades is lower and the average profitable trade is more than three times the average unprofitable one. At the same time, drawdown periods are more protracted. In general, you should prefer the previous trading system.
Intersection of price and shifted moving average
We will consider this option of a trading strategy for the reason that it is used as an input signal in a number of trading systems.
The trading idea is slightly different from the previous case. The whole difference is that instead of the intersection of two moving averages, the intersection of the price and the shifted moving average is used.
For this system, a lot of negative results were obtained, up to 50%, which may indicate the instability of the model. However:
As can be seen, they are commensurate with the model of price crossing one MA without a shift. Here are the summary statistics:
System parameters are very similar to the first TS we reviewed. By the way, if you visually compare all the summary tests, you will see that the yield curves are similar to them - the same growth periods and the same places of serious drawdowns. All this suggests that systems on moving averages generate very similar signals. Somewhere they turn out to be more effective, somewhere less, but the final result largely depends not on specific settings, but on the behavior of the market itself.
Also, all this indirectly indicates a rather high stability of trading systems based on moving averages - if on a particular currency pair most of the settings during optimization give a profit, then it is not so important which ones to use. If the market does not change (trends do not disappear, which is unlikely), then the system is very likely to bring profit to its owner for a long period of time. How acceptable the potential profit is for a trader is another question, but judging by the test results, it has a good chance to suit many.
MA-based multiple time-frame system
This trading strategy is the equivalent of a random intersection of price and moving average, but only for several timeframes that differ in the time scale of data presentation. The essence of the trading idea for this case is as follows: we believe that the trend is upward if the price is greater than all three moving averages, i.e. that three trends of different durations on three multiple timeframes of data presentation are classified as upward. To do this, we take the timeframes H4, D1 and W1 and plot them with moving averages with different periods.
The system turned out to be very stable, negative results were less than 10% of the total mass. However, the results themselves are not very impressive. Here they are:
And here are the results of summary statistics for all tested pairs:
As you can see, the results are not much better than the results of the very first TS we examined.
Trading systems based on the Alligator B. Williams indicator
Opinions about B. Williams' books “Trading Chaos” and “New Dimensions in Exchange Trading” in the trading environment range from complete rejection to enthusiastic worship. What is not, is indifference, and since they say about books and method, then there is something in them, at least, we should pay tribute to B. Williams' popularizing talent.
Bill Williams’s trading strategy is not a mechanical trading system, but a certain trading and analytical complex consisting of a large set of rules and techniques for market analysis and trading operations, guided by which everyone can create their own trading strategy.
We will consider only one of the elements included in B. Williams’s trading and analytical complex and based on the use of a set of shifted moving averages, the so-called Bill Williams ’Alligator, and the simplest trading strategies that can be built on the basis of this indicator.
The Alligator indicator is three shifted moving averages of different periods with different shifts, considered collectively as one object. An alligator is nothing more than a set of three shifted moving averages with periods of 9 (shift 3), 15 (shift 5) and 25 (shift 8), calculated on the median price of the chart. Various combinations of the relative positions of the price chart and indicator elements serve as a guide to certain actions on the market. Alligator is very popular, especially among novice traders. Consider the tests, which gives the use of the Alligator as an element of a trading strategy.
Bill Williams, a psychologist by training, writes figuratively and vividly, given the psychology of the perception of the text by the reader. Therefore, his books are remembered, especially if they were read at the stage of initial acquaintance with the market. The alligator, according to Williams, is hunting for prey, which is the price. When the lines of the Alligator are intertwined with the line of the price chart, then the production is caught, the alligator is full and passive. The trader at this moment is also in standby mode.
Using the Alligator’s passivity, the prey - the price begins to slowly slip out of the indicator line area, the alligator begins to feel hunger, wakes up and opens its mouth, trying to catch the elusive prey. First, the Alligator's lips open - the green line, then the teeth - red, and finally, the jaws open - the blue line.
The indicator lines line up in green-red-blue order and follow the price as the trend continues. Since the trend cannot last indefinitely, sooner or later the alligator catches up with production and the price again falls into the zone of indicator lines. A process with one or another difference is cyclically repeated as new trends appear and develop.
The first trading idea that arises when considering the Williams Alligator indicator is to use it as a trend indicator. If the indicator lines are aligned in the green-red-blue order, then it is obvious that the trend is upward, if the order of the lines is blue-red-green, then the trend is downward. Let's try to test a trading strategy based on the arrangement of alligator lines.
For purchases, we highlighted the simultaneous fulfillment of the conditions that the green line is more red and the red more than blue. For sales - the simultaneous fulfillment of the conditions that the green line is less than the red, and the red is less than the blue. We supplement the condition for opening positions by checking the relative position of the closing price and the Alligator's red line so that there is no conflict between the rules for opening and closing positions. We will not use optimization, we will check the Alligator in its original form.
This system did not give a single positive result:
We examined several typical options for building trading systems based on moving averages, and also examined several filters for entry signals. We found out some interesting features, such as the strong "similarity" of the balance graphs of the tested systems.
In addition, we found the answer to most of the questions posed. For example, we can say for sure that the moving average is still a rather effective tool for technical analysis and that systems based on it can be quite effective. The system at the intersection of two moving averages performed best., while the most effective type of moving average is different for each currency pair.
The typical examples considered by us do not exhaust the entire possible variety of options for using moving averages as elements of trading systems, but they provide the basis for formalizing and researching almost any trading strategies based on moving averages.
In addition, we still have the last question we posed about the feasibility of researching modern trading systems based on moving averages and freely distributed in the network.
Modern trading systems based on moving averages
Regardless of what timeframe the strategy is designed for, we will use H1. We will also apply our rules for exit and tracking positions. This unifies the strategies - in fact, only the rules for entering a position will differ. Thus, we will be able to compare the effectiveness of entering into transactions.
After the breakdown at the cost of EMA8, it is proposed to expect a rollback and touch at the cost of EMA8 for 5-15 candles. In case this happened, a new position is opened in the direction of the initial breakdown. It is proposed to set fixed levels of stop loss and take profit, position tracking is not provided.
The strategy is conceived for the M15 timeframe, but we will use it for H1. We also use various rules to exit and maintain positions. We also slightly modify the entry rules - the candle that touched the MA should be directed towards the open position - this is a small candle filter, which is designed to improve the results of the vehicle.
In fact, this strategy is a more complex modification of the classic breakdown TS by one MA at a price with a filter by the number of candles.
The strategy has proved to be quite stable and its results are quite suitable for real trading. However, the drawdowns are still quite long and amount to a period of up to one year. In addition, several years were closed at zero: 2002, 2004, 2007, 2012, 2017. Nevertheless, the result can be considered quite acceptable.
Battle of the bands - Battle of the bands
The next strategy is called Battle of the bands. The TS is designed for hourly charts and uses a channel of two MAs built at high and low prices. Moving averages with a period of 100 and 200 are used to filter transactions. For sales, the price should be below them, for purchases, above them. The deal is entered when the price breaks through the channel from MA and the Parabolic SAR indicator confirms the trend. In the original, it is supposed to set a stop loss on the opposite side of the MA channel and a trailing stop of approximately 15 points, but we, as usual, use our exit rules.
As you can see, the strategy is almost entirely tied to MA and its rules are quite simple. Let's look at the test results:
The effectiveness of the strategy decreased significantly after 2014, almost to zero. Nevertheless, she worked for a long time and was profitable. It is likely that with additional modifications the vehicle may well be profitable.
EMA + Stochastic
The next system is EMA + Stochastic. This is another fairly simple strategy using three moving averages and a Stochastic oscillator.
The rules are simple and banal. Here is an example for shopping: two fast MAs cross the slow MA, and the stochastic is above a certain level. The figure below is an example for sales:
Now let's look at the results:
The system generated enough deals to evaluate its effectiveness. The average profit is slightly larger than the average loss, and the number of profitable trades is slightly higher than 50%. Judging by the balance curve, trade is quite stable, although 2006, 2011 and 2014 were closed at about zero. This vehicle can be used on a real account.
This strategy uses a moving averages channel. A signal to buy is the crossing of the channel border with a faster moving average. An additional filter is the reading of the ADX indicator and the closing of the candle outside the channel:
Let's take a look at the results:
The system generated enough deals to evaluate its effectiveness. The average profit is slightly larger than the average loss, and the number of profitable trades is slightly higher than 50%. Judging by the balance curve, trade is quite stable, although since 2015 profitability has been almost zero. With some refinement and addition of other tools, the system could be applied on a real account.
As we have seen today, trading systems based on moving averages are still relevant. Judging by the results of our research, based on this indicator, you can develop fairly profitable trading systems that are able to consistently bring profit to their owner over time.
As the results of our tests show, the best option for generating input signals using moving averages is to use the intersection of two cars. This option showed the smoothest yield curve and the best statistics compared to other classical methods of trading moving averages.
Wherein the best option for filtering deals is to wait for a certain number of candles. If, say, for 3-5 candles the conditions for entry did not disappear, such a transaction will be successful with a greater degree of probability. In addition, you can experiment with filtering deals based on the readings of various indicators or candlestick patterns, but this was not our task. Therefore, I give this opportunity to you.
We also got acquainted with several modern trading systems that I accidentally chose on the network. All of them showed very similar results. The main point that I would like to emphasize is that three of the four systems reviewed have lost their effectiveness since 2015. Most likely, this suggests that the authors of manual trading systems make a tight fit to the market, do not use forward testing and in every way violate the basic principles of developing sustainable trading systems. It is not at all surprising that most retail traders lose their deposits using trading systems found on the network and put into a real account without thorough testing for a demo.
Nevertheless, in almost any trading system you can find something interesting - the approach itself, the principles of tracking positions, closing deals or original methods of filtering signals. This can be especially useful for beginners in the Forex market.
Thus, no matter how the moving averages scolded for delays, excessive smoothing, and so on, today we have seen that this is a very effective tool that can and should be used in their trading systems.
Forum Moving Average Topic