For financial purposes a moving average is applied to a time series. The moving average is used to smooth out the noise of every day market volatility and fluctuations so that trends can be recognized. These trends can show possible momentum in a security’s price as well as possible points of support and resistance.
Now there are two ways to do this, calculate it yourself, or have someone else (like a computer) do them for you. I aim to prove to you that calculating them yourself is time consuming and complicated, and that using a computer program that is programmed to do the many, many math equations in a matter of seconds is the way to go. finance.yahoo.com offers a great charting program that will calculate the moving average over any time period for any stock in seconds. However, it is important to understand what the program is doing so you can interpret what it is telling you completley and know how to use the information to its fullest advantage.
As a simple example, take the closing stock price of your favorite stock for the past six days. My favorite stock for this example is an imaginary stock called ZMRP. Below are the closing prices for ZMRP over the past six days:
Day 1: $10 Day 2: $14 Day 3: $12 Day 4: $17 Day 5: $15 Day 6: $18
If you simply took the average of the six days you would have the average price of the stock, $14.3, but not have a good idea of which way the price of the stock is moving; unless, of course, you had additional sets of data. However, if you took the 3-Day Moving Average of stock ZMRP you would have an idea of which way the stock price is moving as well as a smoothed curve that shows deeper trends. To plot the points first take the first three prices, in my example $10, $14, $12, and divide by the period of your moving average, in this example three. You should note that a moving average does not have to be day, it could be any period you desire, seconds, minutes, hours, weeks, months, years, etc., however, when looking at stock prices it is usually best to look at days as they will give you the best gauge of a trend. So, going back to the math our first point is going to be $12 ($10+$14+$12/3days). For the next point you simply move over another day, this time giving us the prices of $14, $12, and $17. Divide by the period, usually denoted by the variable n, and you have the second point for our 3-Day Moving Average, $14.33 ($14+$12+$17/3days). The next point’s prices are $12, $17, and $15, giving an average of $14.67. And the final point for our series has the prices of $17, $15, and $18, giving an average of $16.67. When you plot this you should see something like below:


As you can see the moving average heads in the same direction as the stock price, but takes out some of the dramatic shifts that the price itself shows. This fact would be more pronounced and useful if the value of the period, n, in our case 3, were larger. You may have already figured out that the method above is not the method that you would want to use to calculate a moving average. With much higher amount of periods, such as a 50-Day Moving Average, and for years of data to calculate the average like the way above would take way too much time and would make the information you receive from your analysis possibly more valuable in a measure of your time than the return on a spectacular trade!
To calculate the moving average quicker with larger amounts of numbers you will need to be a little fancier (or use a program that does the fancy dance for you). The equation for calculating the n-period moving average for continuous functions or extremely large data sets is:

Where the variables are defined as:
=moving average for continuous functions
n=the amount of the length of the period; if a 50-Day Moving Average then n would equal 50
x=the data point you begin calculating the moving average for
f(b)=the function that the original data moves upon. Note that the “b” is a dummy variable, meaning it could be anything it just needs to be a place holder.
In as easy to understand speech as possible the equation says, “The moving average for continuous functions equals one over the n-unit of the moving average multiplied against the integral of the function that the data creates over the data point you are calculating at and the data point you are calculating at subtracted by the n-unit of the moving average.” Did that make sense?? Haha, maybe the equation was easier to understand than that sentence. However, even if you do have a complete understanding of that equation and how to calculate integrals there is another problem. Finding the f(b) is not the easiest thing to do. You must find the function that the original data follows, and with highly fluctuating data such as stock prices this can be a difficult task. A goodness of fit test, a stastical model that aims to test how well a model fits a set of observations, can be used to give an estimation of the function for the data as well as a spline function, a function made up of “piecewise” polynomials. Obviously a whole new can of mathematical worms has been opened up! But now that the worms are before you, you can see what is going on behind the scenes when the computer program tosses that fishing line into the water and pulls you out a nice bass of a moving average. Sorry, maybe I got too carried away with that metaphor, haha, but I hope you see my point and have a better understanding of what a moving average represents.