Site Statistics  |   Contact  |   About Us       Thursday, July 29, 2021

HOME ›  AREAS OF EXPERTISE ›   Curve Fitting  ›  ~ Weighted Moving Avg

 "Curve Fitting Solutions" Weighted Moving Average Method
 WMA = (44.1833333333333, 43.7, 43.3666666666667, 43.5666666666667, 43.5666666666667, 43.8666666666667, 44.6, 45.4416666666667, 46.3333333333333, 47.125, 47.9916666666667, 48.4166666666667, 47.775, 47.3833333333333, 47.0083333333333, 46.5166666666667)

 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 Weighted Moving Average

A weighted average is any average that has multiplying factors that give different weights to different data points.

In technical analysis, a weighted moving average specifically means weights which decrease arithmetically. In an n-day weighted moving average the lastest day has weight n, the second latest n-1, etc., down to zero:

 WMA = [np0 + (n -1)p-1 + ... + 2p-n+2) + p-n+1]    /     [n + (n -1) + ... + 2 + 1]
 =
 2/ n(n + 1)   ∑i=0  (n - i) p-i

Testing the Weighted Average Moving Method

Using the algorithm developed under (see) Simple Moving Average, it is possible to implement the weighted moving average method.

In this method, each period's price is multiplied by a given weight. The products of the calculation are summed and divided by the total of the weights.

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 use to calculate a 5-day time frame n weighted moving average.

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 weighted, and simple average. It will show that the weighted moving average is closer to data than the simple moving average is.

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

static void WeightedAverageMovingMethod();
{
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 wma = CurveFitting.WeightedMovingAverage(data, t21);
}

 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

Math, Analysis,
expertise..."

EIGENVALUE SOLUTIONS...
Eigen Inverse Iteration
Rayleigh-Quotient Method
Cubic Spline Method

 Applied Mathematical Algorithms
 A complex number z = x + iy, where... Complex Functions Non-linear system methods... Non Linear Systems Construction of differentiation... Differentiation Consider the function where... Integration
 About Us KMP Engineering is an independent multidisciplinary engineering consulting company specializing in mathematical algorithms.  → ABOUT  → SITE STATISTICS Contact Us KMP ENGINEERING 2461 E Orangethorpe Ave Fullerton, CA 92631 USA info@keystoneminingpost.com Site Map  →  Home  →  Areas of Expertise  →  Reference Items  →  Managed Services  →  Login Mining & Software Engineering