Overview
An Exponential Moving Average is an average of data calculated over a period of time where the most recent days are given more weight. The exponential moving average can be used with any price including a: Hi, Low, Open, and Close, or it could be applied to other indicators. An Exponential Moving average smoothens a data series, which is very important in a volatile market as it helps to remove excess data noise so that significant trends can be identified. Dundas Chart for ASP.NET has four types of moving averages: Simple, Exponential, Triangular, and Weighted. The most important difference between the above moving averages is how they weight their datapoints.
Note |
---|
We recommend that you read Using Financial Formulas before proceeding any further. Using Financial Formulas provides a detailed explanation on how to use formulas, and also explains the various options available to you when applying a formula. |
Figure 1: This chart shows a 20 days Exponential Moving Average, and High, Low and Closeprices using a stock chart. |
Applying an Exponential Moving Average
All formulas are calculated using the FormulaFinancial method, which accepts the following arguments: a formula name; input value(s); output value(s), and parameter(s) that are specific to the type of formula being applied.
Before applying the FormulaFinancial method, make sure that all data points have their XValue property set, and that their series' XValueIndexed property is set to false.
The following table indicates what sort of FormulaFinancial method arguments to use when calculating a Exponential Moving Average, and also supplies a description of what these parameters mean:
Parameter |
Value/Description |
Example |
---|---|---|
Formula Name: |
ExponentialMovingAverage
|
FormulaFinancial(FinancialFormula.ExponentialMovingAverage,"20","Series1:Y2","Series2:Y") |
Input Value: | The value for which the moving average has to be calculated. It could be price as: Hi, Low, Open and Close value. The most used price is closed. |
FormulaFinancial(FinancialFormula.ExponentialMovingAverage,"20"," Series1:Y2","Series2:Y") |
Output Value: (optional) |
The Exponential Moving average. If not specified output is stored in the first input value. |
FormulaFinancial(FinancialFormula.ExponentialMovingAverage,"20","Series1:Y2"," Series2:Y") |
Parameter: |
Period property, used to determine a time period which is used in Exponential Moving Average. |
FormulaFinancial(FinancialFormula.ExponentialMovingAverage,"20","Series1:Y2","Series2:Y") |
A line chart is a good choice when displaying an exponential moving average.
Financial Interpretation: The Exponential Moving Average is used to compare a value with it's exponential moving average. The exponential moving average gives more influence to prices that are more recent, and because of this weighting mechanism, the moving average will follow prices much faster then a simple moving average.
The most important element used in calculating the moving average is the time period used. This time period should be equal to the market cycle observed. The time period influences the percentage which will be used as a weight for the most recent periods.
The Exponential moving average is a lagging indicator, and as such will always trail price. When the price is following a trend, then the exponential moving average will be very close to the price. When a price is going up, then the exponential moving average will most likely fall below the price. This is because of the influence from the historical data.
Calculation: To recalculate an Exponential Moving Average you have to find a percentage which can be applied to the most recent days. The percentage could be determined using a time period:
Next, the Exponential moving average is calculated using today's price, and yesterday's Exponential Moving Average:
Example
This example demonstrates how to calculate a 20 days Moving average using the Formula method
Visual Basic | Copy Code |
---|---|
|
C# | Copy Code |
---|---|
|