Moving Average (MA)

The Moving Average (MA) study plots the average price over a user-specified period. Five methods of calculating the Moving Average are available in CQG: Simple, Smoothed, Centered, Weighted, and Exponential.

CQG also provides the ability to add envelopes to a MA. These lines are added to a MA when a figure is entered under percent. The envelopes are equal to the MA times 1 plus the percent and 1 minus the percent.

Moving averages are one of the most common forms of technical analysis because they tend to be effective tools for identifying the trend of a market.

Many trading strategies use the MA as a filter and only go long when the MA is rising or the price is above the MA and go short only when the MA is falling or the price is below it.

MAs tend to work best in trending markets and often lead to whipsaw type action in a sideways trading range market. Therefore, it is important to use other filters in order to understand trend. One method is to apply the Rate of Change to the average. A secondary method is to move the averages forward via the offset option. This will highlight periods of congestion and allow for a faster observation when a trend is changing. Bill Williams Profitunity Alligator study is one that uses this concept. A final method is track momentum by placing an average on a study, such as the Parabolic. That study is good at catching the first part of a trend, but then is unable to track an extended one. Placing a Moving Average on the Parabolic will ride the trend for longer and maintain more sensitivity than simply using a longer period Moving Average. This concept can be reversed, so a Parabolic is placed on the Moving Average to obtain the same effect.

Traders will often use multiple MAs of different lengths or calculation methodologies and watch for crossover points. The relationship between two MAs may be measured using the Oscillator and MACD studies.

The MA is often considered a support or resistance point.

The MA envelopes are generally used to identify overbought (OB) and oversold (OS) conditions. As with other indicators which provide OB/OS conditions, these may be used to either identify a breakout or an extreme point that may be traded against.

Traders generally consider price activity within the bands to be neutral in nature.

Moving Average Parameters

Parameter

Description

Display

Opens sub-window to set parameters

      Color = Line color.

      Weight = Line thickness.

      Display = Line style: line or histogram.

      ShareScale = Determines whether sharing of the vertical scales between studies is accepted. Auto = System determine whether sharing is feasible. On = Scale is shared regardless of the functions and studies displayed. Off = Scale is not shared. ShareScale must be On if study is overlaid on a study with multiple outputs.

MarkIt

Opens Specify Conditions window.

Offset

Distance in bars between the current bar and the bar to use in the calculation. A positive offset uses future bars. A negative offset uses past bars. For example:

1 = next bar

-2 = two bars back from current bar

Type

Moving average calculation. Values:

      Simple

      Smoothed

      Exponential

      Weighted

      Centered

      Median

      Trix

      Exponential Hull

Period

Number of bars in the lookback range.

Price

Price used to calculate study values.

Percent

Percentage to add to top line and subtract from the bottom line.

 

Moving Average Calculations

MA

Description

Centered

Calculated the same as Simple Average. The difference is where the first point is plotted. A Centered Average plots the first point at the center bar of the specified PERIOD.

For example: The first point for a 3 PERIOD Centered Average would be plotted at the 2nd Bar, where the first point for a 3 PERIOD Simple or Smoothed average would be plotted at the 3rd Bar.

In the case of a Centered Average with an even number of PERIODs, the first point would be plotted at the bar immediately to the right of the center bar.

Exponential

For the following example the PERIOD = 3 and the PRICE = CLOSE.

To calculate an Exponentially Smoothed Moving Average, (ESMA), the user must enter an integer value for the PERIOD or a decimal value Smoothing Constant.

A decimal value Smoothing Constant must be greater than 0.0 and less than or equal to 2.0. Example: .5

When an integer value is entered for PERIOD, the smoothing constant is converted by the system to a decimal value using the following formula:

Smoothing Constant:

= 2 / (PERIOD + 1)

= 2 / (3+1)

= 2 / 4

= .5

The Exponentially Smoothed Moving Average, ESMA, may be calculated after the Smoothing Constant is known.

The first ESMA value is initially set to the first PRICE before the calculation begins. The first PRICE is from the leftmost bar on the screen.

The formula for calculating the ESMA is as follows:

ESMA = pESMA - ( Smoothing Constant X ( pESMA - PRICE ) )

In the above formula:

ESMA is the new Exponentially Smoothed Moving Average.

pESMA is the Previous ESMA value.

PRICE is the value of the PRICE used for each bar, e.g. CLOSE

Note: A decimal value Smoothing Constant equal to 0.0 stops the ESMA from being displayed, however, an ESMA will appear if the integer 0 is entered without the decimal point.

Simple

 

For the following example the PERIOD = 3.

The first value for a Simple Average is determined by formula SIMPLE. It is plotted on the chart at the third bar from the left side of the screen.

SIMPLE = (PRICE 1 + PRICE 2 + PRICE 3) / PERIOD

The next value would be plotted at the fourth bar from the left side of the screen.

SIMPLE = (PRICE 2 + PRICE 3 + PRICE 4)/PERIOD

Subsequent values would be determined by eliminating the oldest PRICE from the calculation, and including the next more recent PRICE.

Smoothed

Similar to a simple moving average. However, in a smoothed moving average, rather than subtracting the oldest value, as in a simple moving average, the previous smoothed average value is subtracted.

For the following example the PERIOD = 3.

First value is ready when Period first bars are accumulated.

First value SMOOTH(1) = AccumulatedPrice / Period where AccumulatedPrice is a sum of Period input prices.

Next value (say SMOOTH(N)) is calculated as:

SMOOTH(N) = SMOOTH(N-1) + (Price(N) - SMOOTH(N-1)) / Period

The next value would be plotted at the fourth bar from the left side of the screen.

SMOOTH2 = (PREVIOUS SUM - PREVIOUS AVG + PRICE 4) / PERIOD

For the second calculation of SMOOTH, PREVIOUS SUM is the sum of PRICE 1 + PRICE 2 + PRICE 3; and PREVIOUS AVG is the initial value of SMOOTH.

The next value would be plotted at the fifth bar from the left side of the screen.

SMOOTH = (PREVIOUS SUM - PREVIOUS AVG + PRICE 5) / PERIOD

Subsequent values would be determined by subtracting the PREVIOUS AVG from the PREVIOUS SUM, adding the next more recent PRICE, then dividing by the PERIOD.

Example:      

If the values 1,2,3,4 and 5 were reported for the first 5 bars the 3-period smoothed moving averages for those bars would be calculated as follows:

(1+2 +3)/3 = 2

This is the first value and would be plotted on the 3rd bar from the left.

(6 - 2 + 4)/3 = 2.67

This second value would be plotted on the 4th bar from the left.

(8-2.67+5)/3 = 3.44

This third value would be plotted on the 5th bar from the left.

Weighted

Assigns weights linearly, assigning greater weights to more recent data points.

Example:

A 21 period weighted moving average would be calculated as follows:

[21 * Close (0)] + [20 * Close (-1)] + [19 * Close (-2)] +…….[1 * Close (-20)]

Median

 

The median moving average is simply the center value in a series. For example, the ten period median average of (8, 6, 7, 8, 9, 10, 9, 8, 5, 4) is 8.

 

Trix

 

This is a triple smoothing of the data using exponential moving averages with the same smoothing constant (EMA period):

Price(i) = current price;

N = EMA period;

EMA1(i) = the first EMA smoothing of the data.

Followed by the second smoothing of the first EMA, which is a double exponential smoothing:

EMA2(i) = EMA(EMA1, N, i).

Next, the double Exponential Moving Average is smoothed exponentially one more time:

EMA3(i) = EMA(EMA2, N, i)

 

Exponential Hull Moving Average

The Exponential Hull Moving Average uses the difference between two exponential moving averages for the smoothing of the data. There are three steps:

N = EMA period

Step 1. Calculate the exponential moving average using the period N/2 and multiply the result by 2.

Step 2.  Calculate the exponential moving average using the period N and subtract that from the result of Step 1.

Step 3. Calculate the exponential moving average of the results from Step 2 using the period square root (N).

Exp Hull = EMA(2*EMA(N/2) − EMA(N),Sqrt(N))