Home Login  |   Contact  |   About Us       Tuesday, October 15, 2024   

j0182084- Back to Home
   Skip Navigation LinksHOME ›  AREAS OF EXPERTISE  #2 ›   Curve Fitting  ›  ~ Expontl Moving Avg



Skip Navigation Links.



"Curve Fitting Solutions"
Exponential Moving Average Method
EMA =


DATA ARRAY

{ , , , , , , , , ,
, , , , , , , , , }



[ Initial Data Array(top): { 45.375, 45.500, 45.000, 43.625, 43.375, 43.125, 43.125, 44.250, 43.500, 44.375 } ]
[ Initial Data Array(bot): { 45.875, 46.750, 47.625, 48.000, 49.125, 48.750, 46.125, 46.750, 46.625, 46.000 } ]

Time Frame:

                                       

IMPLEMENTATION
Curve Fitting Exponential Moving Average

One drawback of both the simple and weighted moving average (see) Simple Moving Average and Weighted Moving Average is that they include data for only the number of periods the moving average covers. For example, a 5-day simple or weighted moving average only uses five days' worth of data. Data prior to those five days are not included in the calculation of the moving average.

In some situations, however, the prior data is an important reflection of prices and should be included in a moving average calculation. This can be achieved by using an exponential moving average.

An exponential moving average (EMA) uses weight factors that decrease exponentially. The weight for each older data point decreases exponentially, giving much more importance to recent observations while still not discarding older observations entirely.

The formula for calculating the EMA at time periods t ≥ 2 is:

Si = Þ Yt-1 + (1 - Þ) St-1

This formula can also be expressed in technical analysis terms as follows, showing how the EMA steps towards the latest data point:

EMAtoday = EMAyesterday + Þ(p0 - EMAyesterday)



Testing the Exponential Average Moving Method

As a sample we provide the input data points using one double array using data of a stock for 20 days (Data Array), we use the same closing data of stock for 20 days that was used under Simple Moving Average and Weighted Moving Average to calculate a 5-day time frame n.

Running this application produces the results WMA shown above.

The user can manipulate all values and try variations on the arrays themselves by specifying new estimate values. For comparison purposes, the user can plot the data, the 5-day simple, weighted and exponential average. It will show how the three methods perform under similar input conditions.

In order to test the Exponential Average Moving Method as defined above, a new ExponentialAverageMovingMethod() static method has been added and executed. Supporting code and methods are not shown.

           static void ExponentialAverageMovingMethod();
              {
                 ListBox1.Items.Clear();
                 double[] xarray = new double[] {t1, t2, t3, t4, t5, t6, t7, t8,
                 t9, t10, t11, t12, t13, t14, t15, t16,
                 t17, t18, t19, t20};
                 VectorR ema = CurveFitting.ExponentialMovingAverage(data, t21);
                 ListBox1.Items.Add(" " + ema.ToString());
              }



Other Implementations...


Object-Oriented Implementation
Graphics and Animation
Sample Applications
Ore Extraction Optimization
Vectors and Matrices
Complex Numbers and Functions
Ordinary Differential Equations - Euler Method
Ordinary Differential Equations 2nd-Order Runge-Kutta
Ordinary Differential Equations 4th-Order Runge-Kutta
Higher Order Differential Equations
Nonlinear Systems
Numerical Integration
Numerical Differentiation
Function Evaluation


   Quotes

Consulting Services - Back to Home


Home

Home Math, Analysis,
  expertise..."

EIGENVALUE
SOLUTIONS...


> Rayleigh-Quotient Method

> Cubic Spline Method

 

Applied Mathematical Algorithms

Home

ComplexFunctions

Home

NonLinear
Home

Differentiation
Home

Integration
About Us


KMP Software Engineering is an independent multidisciplinary engineering consulting company specializing in mathematical algorithms.

      (About Us) →
Areas of
Expertise


SpecialFunctions
VectorsMatrices
OptimizationMethods
ComplexNumbers
Interpolation
CurveFitting
NonLinearSystems
LinearEquations
DistributionFunctions
NumericalDifferentiation
NumericalIntegration
DifferentialEquations
Smalltalk
FiniteBoundary
Eigenvalue
Graphics
Understanding
Mining


MiningMastery
MineralNews
MineralCommodities
MineralForum
Crystallography
Services


NumericalModeling
WebServices
MainframeServices
OutsourceServices

LINKED IN
MINE REVIEW(by G.Pacheco)
Brand





Home

Login

Contact
Since 2006 All Rights Reserved  © KMP Software Engineering LINKS | PRIVACY POLICY | LEGAL NOTICE