Moving Averages

There are several types of moving averages currently in use today. The moving average is used to observe price changes. Barchart Trader contains the following Moving Averages:

Simple, Envelope, Exponential, HiLo Channel, Offset, Offset Midpoint, Percent Channel, Smoothed, Variable

Study Type: Overlay

Simple Moving Average

The most basic is the simple moving average which takes the prices from the previous user-defined number of periods, sums them up and divides by the number of periods. A 10 day average is simply the average closing price for the past 10 days. Each successive day is calculated fresh from the 10 most recent days. This is how the average "moves". The number of periods to use in the average depends on the stock or commodity being analyzed. Typically, it is related to the cycle of the underlying item, such as a four year stock market cycle, seasonal heating oil cycle and an agricultural harvest cycle.

The average is overlaid on the price chart and crossovers between the average and the underlying price are observed. When prices are rising they are usually above the average. This is to be expected since the average includes data from the previous, lower priced days. As long as prices remain above the average there is strength in the market. Buyers are willing to pay more for the stock or commodity as the market continues to value it higher.

When prices cross below the average it means that the market no longer expects prices to continue higher, at least temporarily. The more market participants taking this new view, the higher the volume will be and the better the signal. Remember, the valuation in the market is based on what market participants think will happen in the future. If the price is expected to rise, buyers will buy it now at the lower price which in turn causes demand to rise. Rising demand means higher prices and the self-fulfilling prophesy will been sustained.


  • Period: (10) - the number of bars, or period, used to calculate the study.


Moving Average Envelope

The Price Envelope study (sometimes referred to as "Envelope") is a derivative of the moving average study. It uses only one moving average, which you specify. You also determine the price band.

The price band has two lines which are an equal percentage distance from the exponential, smoothed, or normal moving average. The moving average line is not visible.

While several different trading rules are available, the most simple approach uses the price band as an entry and exit point. When price penetrates the upper price band, you initiate a long position or buy. If you have an existing short position, you close out shorts and go long. Conversely, when prices penetrate the lower price band, you close out long positions and go short.

In Kaufman's book, Commodity Trading Systems and Methods, he suggests several other approaches. They are as follows:

  • Buy or sell on the close after a signal is indicated.
  • Buy or sell on the next market open following a signal.
  • Buy or sell with a delay of 1-3 days after the signal.
  • Buy or sell after a price retracement of 50% (or some other value) following a signal.
  • Buy or sell when prices move to within a specified risk relative to a stop-loss point.

In the case of using the moving average envelope on intraday prices, Kaufman suggested the following rule. "Only one order can be executed in one day, either the liquidation of a current position or an entry into a new position."

Kaufman's book is an excellent source and reference. While it is definitely written for a mathematically inclined individual, a novice trader would benefit from several of the chapters, especially the chapters on moving averages, oscillators and technical analysis.


The indicator first computes the moving average. It then computes the percentage band around the moving average. The formula follows:

Mat = (P1 +... + Pn) / n

  • Mat is the moving average.
  • Pn is the price for the nth interval.
  • n is the length of the moving average.

It then computes the average of the past n intervals.

The software requires you to input a percentage value for the price band in hundredths of a percent. Using that percentage figure, the computations are as follows:

  • UBt = Mat + (Mat * %P)
  • LBt = Mat - (Mat * %P)
  • UBt is the upper price band.
  • LBt is the lower price band.
  • Mat is the moving average for the current interval.
  • %P is the percentage value for the price band.


  • Period (10) - the number of bars, or period, used to calculate the moving average.
  • Percent (3) - a percentage value for the price band. A value of .03 indicates 3/100 or 3%, a value of .05 indicates 5/100 or 5%.


Moving Average Exponential

The Exponential Moving Average assigns a weight to the price data as the average is calculated. The more recent the price the heavier the weighting. The oldest price data in the exponential moving average is never removed from the calculation, but its weighting is decreased the further back it gets in the calculations.

As an example, the calculations for a 10 period exponential moving average are as follows:

  • First, go back to the beginning of trading or back 1 year or anything consistent. The longer the period, the more accurate the result.
  • Add up the closing prices for the first 10 periods and divide by 10. This is the result for the 10th period (there are no results for periods 1 thru 9)
  • Then take 9/10 of the 10th period result plus 1/10 of the 11th period close. This is the 11th day result, etc, etc.

Barchart Trader uses the classical exponential smoothing formulas described by H. Wells Wilder in his book "New Concepts in Technical Analysis". This defines the smoothing factor as 1/days or 1/3 for a 3 day exponential moving average study. The result of the study will then be 2/3 of the old value plus 1/3 of the new. Others have developed their own formulas. 1/2 smoothing will give "faster" results than 1/3 smoothing. You might get an equivalent result if you used a 2-day smoothing factor on the calculations. Alternatively, if you want a 1/3 smoothing, you might try a 5 day factor, 2/(5+1)= 2/6 = 1/3.


  • Period (20) - the number of bars, or period, used to calculate the moving average.


Moving Average HiLo Channel

The High-Low projections is plotted as a channel around the chart. It is used to generate support and resistance levels, with the understanding that if the price breaks through either of these levels then the market has entered a new trend.

The Formula is:

  • Res = ((hi+lo+cl)/3)*2
  • Projected high for next day = res minus lo
  • Projected low for next day = res minus hi

The study is plotted as channel, on top of the next days ohlc bars. The calculation uses the True High and True low. The true high is the greater of today's high price and yesterday's closing price. The true low is the lesser of today's low price and yesterday's closing price.


  • Period High (10) - the number of bars, or period, used to calculate the moving average.
  • Period Low (8) - the number of bars, or period, used to calculate the moving average.


Moving Average Offset

The Offset Moving Average is a simple moving average offset by moving the average "x" periods to the right, where "x" is the second argument. The first argument is used to calculate the simple moving average of the price, and the second argument determines the number of offsets to the right, hence shifting the moving average "x" periods to the right. The Exponential Moving Average is the same except it uses the exponential moving average in the calculation.


  • Period (20) - the number of bars, or period, used to calculate the moving average.
  • Offset (6) - the number of bars, or period, to offset to the right

Moving Average Offset Midpoint

The Offset MidPoint Average is a simple moving average calculated from the average of the high and low for the period, offset by moving the average "x" periods to the right, where "x" is the second argument.


  • Period (20) - the number of bars, or period, used to calculate the moving average.
  • Offset (6) - the number of bars, or period, to offset to the right


Moving Average Percent Channel

The Moving Average Percent Channel draws an upper and lower channel, one of which is a certain percentage smaller, the other a certain percentage greater, than the simple moving average.

Prices can move up and down in the form of trends, but they also often bounce up and down in a horizontal manner. These short-term price movements define a channel and are known as consolidations. Unless there is a clear reversal out of the trend, prices tend to bounce off the upper and lower edges of the channel. A well-defined channel sets the boundaries beyond which the price does not usually move. Adding channels to charts will help identify instances of over or under-priced trades.

The price will generally return to the channel after penetrating the upper or lower edge. In addition, once it touches one side of the channel it will, unless there is a major change in the trend, move back to the other side.

The purpose of channels is that they provide you with an indicator of the stock’s "normal" price movements. That is, its standard volatility. This should help you to ignore the smaller wiggles in its movement and instead concentrate on the larger picture. However, it is important to wait for confirmation that the price is moving well above or below the channel before making a trade as it can often just penetrate and then return.



  • Period: (10) - The first argument (AvgNum) is the x-day moving average of the closing price
  • Channel 1/1000: (500) - the second argument (Y) is used as (Y/10,000*Price) plotted as a channel around over and under the result of the x-day moving average.


Moving Average Smoothed

The effect of the moving average is to smooth the price movement so that the longer term trend becomes less volatile and therefore more obvious. When the price rises above the moving average, it indicates that investors are becoming bullish on the commodity. When the prices falls below, it indicates a bearish commodity. As well, when a moving average crosses below a longer term moving average, the study indicates a down turn in the market. When a short term moving average crosses above a longer term moving average, this indicates an upswing in the market. The longer the period of the moving average, the smoother the price movement is. Longer moving averages are used to isolate long term trends.


  • Period: (9) - the number of bars, or period, used to calculate the study.

Moving Average Variable

Variable Moving Average, often abbreviated as VMA, is an Exponential Moving Average. It was developed by Tushar S. Chande in 1991. VMA automatically adjusts its smoothing constant on the basis of Market Volatility. The Sensitivity of Variable Moving Average keeps growing provided the volatility of data considered is increasing. A major flaw in all forms of moving averages is that, they are unable to function properly and predict future trend during Trending and Non-Trending movements of Stocks occurring one after another. Similarly, when moving averages are determined over a longer period of time, Moving Averages are unable to respond to trend reversals. This may lead to disastrous trade signals. Variable Moving Averages distinguishes itself from other moving averages on the basis of sensitivity. VMA functions far better than other moving averages because it adjusts its smoothing constant according to market conditions like Market Volatility.

If data provided is more volatile then latest figures are given more weight. VMA not only shortens it average time period when market is trending but it also increases its length if market is non-trending highly volatile markets. Any Tool can be used to determine Volatility in Variable Moving Average. Most Common Tool to determine Volatility is a 9 Period Chande Momentum Oscillator. Chande presented the idea of using Volatility Index to determine the smoothing period. In order to function properly, the Volatility Index must catch up the pace of market trend. If it is highly trending, the Volatility Index must adjust its length to determine price trends of immense importance. Another recent development in CMO is the use of Absolute CMO to determine Volatility Index. 

In order to Calculate Variable Moving Average, we must determine a method to calculate Volatility Index. Standard Deviation or Chande Momentum Oscillator are frequently used by Traders to determine Volatility Index. 

The basic difference between Variable Moving Average and other Moving Averages is that, VMA doesn’t have any upper boundary to its Smoothing Constant. 



  • Period 1: (14) - the number of bars, or period, used to calculate the study.
  • Period 2: (20) - the number of bars, or period, used to calculate the study.
  • Period 3: (6) - the number of bars, or period, used to calculate the study.