Moving Averages vs Trend Lines

by | Mar 3, 2018 | Technical Analysis | 0 comments

There are many technical indicators for all preferences and styles. Moving averages and Trend lines are among the most comon of them. Moving averages can be traced back to Richard Donchian and the trend following Turtles back in the 50s and 60s. Trendlines in the context of trading are probably as old as the charts themselfs. These two indicators have some similarities and some differences. You should keep them in mind and know when to use one or the other.

What are Moving Averages?

Simply put, a moving average is a tool employed by many technical analysts to smooth out price fluctuations in a chart. They are more like a noise filter removing all those unnecessary spikes and helping the trader have a clear view of the general direction of price movement, the trend.

As the name suggest, a moving average is based off a mathematical formula and all it does is average out price points drawn from a specific period.

In mathematics and statistics, the arithmetic mean  or simply the mean or average, is the sum of a collection of numbers divided by the number of numbers in the collection. (from Wikipedia)

To demonstrate, a 20 period Moving Average will continuously average the closing point of the last 20 closing prices in any time frame. The good thing is that it can be modified and according to the needs of a trader. The moving average can be based off the closing, open, median, high or even low. It is that flexible and as such it is attractive to most traders.

Now, the simple moving average (SMA) is the default moving average in any Forex chart and the “simple” bit means that prices are equally distributed across the period. Then there is Exponential Moving averages (EMA) which are more sensitive to price swings and are weighted such that recent prices take precedence. Others include Weighted Moving Averages (WMA), Hull Moving Averages (HMA) and many more.

To manually calculate the SMA in mql4 (the language of Metatrader 4), you could write code similar to this one:

double CalcSimpleMovingAverage(string symbol,int period,ENUM_TIMEFRAMES timeframe)
  double total=0;
  double prices[];


  for(int i=0;i<period;i++)
  return total/period;

But fortunately you dont have to. The MT4 platform gives you the possibility to use the built-in function iMA. This way you can calculate the SMA in a single line of code:

double sma = iMA(Symbol(), PERIOD_CURRENT, 20, 0, MODE_SMA, PRICE_CLOSE, 0);


How to use Moving Averages

The base line is this, all moving averages are analytical tools used for trend definition. It doesn’t matter the pair being traded. They will adapt and automatically average out prices according to your setting, helping you identify the general trend and, for trend traders, enter trades accordingly.

For best results, many traders combine different period moving averages creating a moving average trading strategy. In my strategy, I often use 3 moving averages and trade on cross overs.

  • The 200 period MA is used to identify trends and every time prices are moving above it, then it is best to look for buy opportunities and vice versa.
  • The 20 and 50 period MAs are used for creating buy and sell signals according to the direction of trend when there are cross overs.

To help me trade this strategy on Metatrader4 I created the MTF Triple Moving Averages indicator that is available here.

Here is how I use them. Let’s look at this example on the EURUSD pair on the daily chart:

Simple Moving Averages example – Buy Entry and Exit

For buy entries:

  1. I first of all determine the overall trend by looking at price action relative to the 200 period MA.
  2. If prices are above it, then I will only go long or buy when the 20 MA crosses over the 50 MA to the upside.
  3. I will then place my stop loss below the recent swing low and ride with the tide until when momentum reduces as the 20 MA crosses the 50 MA to the downside.

Simple Moving Averages example – Sell Entry and Exit

For Sell Entries:

  1. I first of all determine the overall trend by looking at price action relative to the 200 period MA.
  2. If prices are below it, then I will only go short or sell when the 20 MA crosses over the 50 MA to the downside.
  3. I will then place my stop loss below the recent swing high and ride with the tide until when momentum reduces as the 20 MA crosses the 50 MA to the upside.

SMA During Ranging Markets

As you can see, buy and sell signals are generated and even if they are perfect when prices are trending, the use of simple moving averages can be dismissive if prices are ranging.

This means, even if this strategy is successfully, it cannot be used in isolation and this is where use of trend lines can be used for fine tuning entries and exits.

What are Trend Lines?

In layman’s terms, trend lines are a simple, visual representation of the general direction of price and used to connect recent swing highs or lows in a chart. Whenever you see a trend line in any chart, then know that those are key inflection points which a trader thinks could influence future prices.

Know this though, trend lines are significant but are highly subjective and drawn according to how a trader is comfortable with. What I’m saying is, there is no formula on how to draw a trend line. You simply have to “use” your eyes as they say.

In finance, a trend line is a bounding line for the price movement of a security. It is formed when a diagonal line can be drawn between a minimum of three or more price pivot points. A line can be drawn between any two points, but it does not qualify as a trend line until tested. Hence the need for the third point, the test. (from Wikipedia)

There are two ways of drawing a trend line.

  1. You can connect three or more lows as your swing lows to draw a support trend line.
  2. Three or more highs as your swing highs to draw a resistance trend line.

If you chose one style, better stick with it to avoid confusion.

As trend lines are representatives of support or resistance they can be used to identify a down trend, an uptrend or a ranging market. Besides trend identification, the slope of a trendline can be used to know the speed or the rate of price change. A steep trendline indicates that price is changing rapidly and that the trend is strong. However in my experience, very steep trendlines dont usually last very long until they are broken.

Trendline with a steep slope

On the other hand, a trendline with a low angle slope means that the rate of price change is slower and that the trend is somewhat flat. Usually these types of trenlines are more resilient and last longer until they are broken.

Trendline with a low slope

How to use Trend Lines

Unlike moving averages, there are two ways of trading using trend lines.

  1. You can use it as valid support or resistance in a trending market (in mean reversion strategies).
  2. Alternatively, you can trade trend line break outs in your preferred time frame (in trend following strategies).

As liquidating or loading lines, this is how trend lines are used:

Trend Lines Buy Entry and Exit

In an uptrend, determine the support trend line by connecting at least 3 swing lows and wait for entries. Ideal buys are when there are confirmed bounce off this support line with stop loss slightly below recent lows and support.

Trend Line Sell Entry and Exit

In a down trend-when prices have a negative slope, all you have to do is connect at 3 swing highs if you need a reliable resistance trend line. Thereafter, wait for any rebound off this resistance line and sell with stops above the resistance trend line.

When trend lines are used to filter out bull or bear break outs, then they can turn out to be very profitable. As we can see from the examples below, break outs are when prices “break away” from marked support or resistance levels in a chart.

Bearish Break Out

A bearish break out happens when prices break below support while a bullish break out occur when buyers, called bulls, push prices above resistance levels.

Bullish Break Out

Often, most profitable break outs happen when prices are moving away after an extend period of consolidation.

Similarities and Differences of Moving Averages and Trend Lines

Either you decide to use moving averages or trend lines or a combination of both it is always safer if you trade according to the prevailing trend.

As moving averages are not very usefull for ranging market environments. You can use trend lines to define the range using support and resistance. This way you can seen when price breaks out of the range and the trend resumes.

One big difference is that while a trader can use different MAs within a single chart and customize each according to his/her preference, trend lines are usually subjective and can be drawn differently depending on the trader’s approach. This is also the reason why you can create an algorithm from a moving average strategy while it’s pretty hard to develop one from trend lines.

Notice this though, even if they appear simple, no one strategy is fool proof. You will get false break outs or signals from time to time. This is why you should always put in place a good risk management strategy and aim for a good risk reward ratio. This way you can protect your capital in case you take a hit.



Trendline EA

MTF Bollinger Bands

MTF Triple MA


Submit a Comment

Your email address will not be published.