Click or drag to resize

Exponential Moving Average

The Exponential Moving Average (Ema) is a staple of technical analysis and is used in countless technical indicators.  In a Simple Moving Average, each value in the time period carries equal weight, and values outside of the time period are not included in the average.  However, the Exponential Moving Average is a cumulative calculation, including all data.  Past values have a diminishing contribution to the average, while more recent values have a greater contribution. This method allows the moving average to be more responsive to changes in the data.

Market Signals

Typically, the signal to buy comes in when the Ema crosses price from above. When Ema crosses price from below, it is a signal to sell.


Exponential Moving Average 001

Exponential Moving Average 002

Chart Example

Exponential Moving Average 003

Implementation and Usage

To initialize Exponential Moving Average indicator, use one of the following constructors:

Ema – set default values: period = 14

Ema(Int32) – set value for period

Ema(Double) – set value for factor (K in formula)


EMA - property to get current value

 1// Create new instance
 2Ema ema = new Ema(28);
 4// Number of stored values
 5ema.HistoryCapacity = 2;
 7// Add new data point
10// Get indicator value
11double IndicatorValue = ema.EMA;
12// Get previous value
13if (ema.HistoryCount == 2)
15    double IndicatorPrevValue = ema[1];