# Distance from Moving Average

## Introduction

Distance From Moving Average is a simple indicator that shows how far above or below its moving average a security is trading. Of course, chartists can easily determine whether the security is trading above or below its moving average by viewing a chart with that moving average plotted on it. However, this indicator allows chartists to more easily determine exactly how far above or below the average price is, which can give clues as to the strength or weakness of the security's move.

In addition, the distance is expressed as a percentage of the moving average value. A \$5 difference between price and its MA on a \$20 stock is much more noteworthy than a \$5 difference on a \$500 stock. Using percentages for this indicator makes for easier comparison across different timeframes and even different securities.

## Calculation

The formula for this indicator is quite simple:

`(close - MA)/MA`

The MA value is subtracted from the close in order to determine the difference between the two values. The difference is divided by the MA value in order to convert the raw value to a percentage.

Note: Our formula above is not specific about the type of moving average. This indicator can be charted with either a simple or exponential moving average (SMA or EMA).

## Interpretation

Indicator values can fall above or below the zero line, depending on whether price is above or below the moving average. Zero line crossovers correspond to price/MA crossovers, but those crossovers are relatively easy to spot on the chart itself.

### Extreme Levels

The Distance From MA indicator is more often used to look for extreme values on either side of the zero line, which may indicate a coming change in the trend. A value that has risen far above the zero line may be ripe for a pullback or correction. Conversely, a value that has fallen far below the zero line may indicate a reaction rally is coming soon.

While these signals can be estimated just by looking at a chart, expressing the values as a percentage allows chartists to compare historical levels of a security over time, as well as comparing levels between more than one security.

Note: Even with the values expressed as a percentage, different securities may have somewhat different extreme levels. It is recommended to first look at a long-term chart of the security to get an idea of its unique extreme levels.

### A Word of Caution

This indicator measures the distance between price and its moving average, but it doesn't take into account the overall trend of the security. A price that is far above its moving average may be a sign of strength during a strong uptrend, but in a sideways trading range, it's more likely to indicate a change in trend. It is important to use other technical analysis techniques to identify the overall trend when interpreting this indicator.

## Conclusion

The Distance From Moving Average indicator compares the distance between a security's price and its moving average to identify possible reversals. Zero line crossovers can signal a change in trend. Extreme values either above or below the zero line can signal that the security is due for a correction or rally.

The extreme levels will vary slightly from security to security, and the interpretation of those signals depends on the security's overall trend, so this indicator should not be used on its own. Traders should always use the Distance From Moving Average indicator in conjunction with other indicators and analysis techniques.

## Charting with the Distance From Moving Average Indicator

The Distance From Moving Average indicator can be charted on StockChartsACP after installing our free Advanced Indicator Pack. Please see our StockChartsACP Plug-Ins article in the Support Center for more information on installing this plug-in.

Once the plug-in is installed, the Distance From Moving Average indicator can be added from the Chart Settings panel for your StockChartsACP chart. The indicator can be positioned above, below, or behind the security's price plot.

By default, the indicator uses a 200-period SMA, but the number of periods and the type of moving average can be adjusted to meet your technical analysis needs. In addition, the indicator values can be plotted as either a line chart or a histogram.

## Scanning for Distance From Moving Average

StockCharts members can screen for stocks based on the price's difference from the moving average. Below are some example scans that can be used for signals based on the price's distance from a moving average. Simply copy the scan text and paste it into the Scan Criteria box in the Advanced Scan Workbench.

Members can also set up alerts to notify them when a signal is triggered for a stock based on the distance of price from its moving average. Alerts use the same syntax as scans, so the sample scans below can be used as a starting point for setting up alerts as well. Simply copy the scan text and paste it into the Alert Criteria box in the Technical Alert Workbench.

### Extreme Distance Above SMA

This scan looks for stocks that are trading farther than usual above their 50-day simple moving average on below-average volume. This may indicate an uptrend that is running out of steam and ripe for a reversal.

```[type = stock] AND [country = US]
AND [Daily SMA(20,Daily Volume) > 40000]
AND [Daily SMA(60,Daily Close) > 20]

AND [DistFromSMA(50,Daily Close) > 20]
AND [Daily Volume < Daily SMA(200,Daily Volume)]```

### Extreme Distance Below EMA

This scan looks for stocks that are trading farther than usual below their 50-day exponential moving average on below-average volume. This may indicate a downtrend that is petering out and ready to turn upward.

```[type = stock] AND [country = US]
AND [Daily SMA(20,Daily Volume) > 40000]
AND [Daily SMA(60,Daily Close) > 20]

AND [DistFromEMA(50,Daily Close) < -20]
AND [Daily Volume < Daily SMA(200,Daily Volume)]```

For more details on the syntax to use for Distance From MA scans, please see our Scanning Indicator Reference in the Support Center.