MOVING AVERAGES
Each day we compute the Average stock price over the past N days ... and plot it.
We might also compute the average price over the past M days ... and plot it.
When they cross we BUY ... or maybe we SELL
depending upon whether the crossing is from above or below
It might look like so:

So we play with the numbers M and N until we're happy.

Of course, a simple 200-day Moving Average, like MA = (P1 + P2 + P3 + ... + P200)/200, gives equal weight to all Prices, even the one that occurred 200 days ago! So, if we want to give more weight to more recent Prices, we could use a Weighted Moving Average:

WMA = (P1 + 2P2 + 3P3 + ... + 200P200)/K

where K is a magic number (which we'll explain in a minute).

Note that we are assuming that P1 is the price 200 days ago and P200 is the most recent Price ... and this most recent price is multiplied by 200 so it's 200 times more significant than the 200-day old Price, right?

Okay, what's K?
If all Prices are equal to, say P, we want the weighted average to equal P as well. That means:

WMA = (P + 2P + 3P + ... + 200P)/K = P(1 + 2 + 3 + ... + 200)/K
must equal P, so K must equal (1 + 2 + 3 + ... + 200).

As you might imagine, there's a magic formula for this sum, namely:

1 + 2 + 3 + ... + 200 = 200*201/2 so that's the value for K.

In general, for an N-day moving average, we have
K = 1 + 2 + 3 + ... + N = N(N+1)/2
(I think Euler discovered this when he was six years old. How does that make you feel?)

Our Weighted Moving Average is now:

Weighted Moving Average = WMA= 2(P1 + 2P2 + 3P3 + ... + N PN)/{N(N+1)}

Of course, nobody sez that the relative weights 1, 2, 3, ... are etched in stone. We could choose any weights w1, w2, w3, ... wN, and get:

Weighted Moving Average = WMA = (w1P1 + w2P2 + w3P3 + ... + wN PN)/K
where K = w1 + w2 + w3 + ... + wN = Σ wk

Note that the number K is chosen so that, in the case where all Prices are equal, the Moving Average is equal to that Price as well.

It's time for a picture (where we use the weights 1, 2, 3, ...):

Note that the Weighted Moving Average (which emphasizes more recent Prices) follows the stock price more closely than the Simple 20-day average.


VOLUME-weighted MOVING AVERAGE
There are jillions of Weighted Moving Averages; we pick our weights as the periods of oscillation of a butterfly wing and we've got ourself another WMA. Most play with just the stock price and ignore the volume of stock traded at that price.

If today's closing price is $16 and last month it closed at $12, then is today's price more significant ... because it's more recent (hence more relevant)? I don't think so, not if only ten shares traded at $16 whereas ten million traded last month at $12. (Okay, I exaggerate, but you get the idea, no?) That brings us to my favourite (which we'll call VMA), not necessarily because it gives better BUY/SELL signals, but because it makes some sense (to me, cuz VMAN-day is approximately the average price paid for each share of stock over the past N days).

It's simple.
We take, as weights w1, w2, w3, etc. the volumes of stock traded at Prices P1, P2, P3, etc. and get:

Volume-Weighted Average = VMA = (V1P1 + V2P2 + V3P3 + ... + VN PN)/K
where K = V1 + V2 + V3 + ... + VN = Σ Vk

Here's a stock and the volume of trades:


The trading price in May was really important ... look at the volume! Anyway, we plot the weighted moving average over, say N = 100 days (why not?) and get:


I'm getting ahead of myself.
We see the stock price and the 100-day VMA in a lovely blue and also the 5-day Moving Average. (I hate to place too much stock ... uh, emphasis, on the dynamics of the stock price; it's too finicky, too nervous, too apt to spike-then-fall, too volatile ... so we use a fast moving average, like 5-day, 'cause it follows the stock price pretty closely and it's smooother, right?)

So what're the BUY/SELL signals?
Stare at the plot and decide when you'd like to BUY or SELL.
At those points, note that the VMA is a long way from the fast (5-day) average. That provides our signals:

When VMA - (5-day) > A then we BUY.
When VMA - (5-day) < B then we SELL.

For example, if we plot the difference VMA - (5-day) we get:


OOPs! I've used the label VA for the Volume Weighted Average, rather than VMA; sorry 'bout that.

And what're optimal choices for A and B?
(Above, I chose A = 1.5 and B = -1.5 at my wife's suggestion.)
And is 5 the best number of days for the fast average?
And why is 100 chosen in the VMA?
(Because there are 100 cents/dollar or 100 asparagus in my garden?)
You Decide!
One other thing:
Some people caculate the Volume Weighted Average Price after each trade, throughout the day! If they can buy a stock at less than this
VWAP, that's good. If they can sell stock at a price higher than the VWAP, that's good, too.


So why do I like VMA (as opposed to the other jillion technical indicators)?

Suppose there are just two traders, Buyers and Sellers.
The average price paid by Buyer, in the past, is $16. It was sold to him by Seller.

Suppose the stock price goes up significantly from $16, then Buyer will sell (in order to lock in his profits). This will drive the price down, so, as a VMA-observer we should SELL as well.

Suppose, on the other hand, the price goes down significantly, then Seller (she had previously sold to Buyer) will jump back in cuz the stock is now cheap again. This will drive the price up, so, as a VMA-observer we should BUY as well.

The problem is, of course, to identify this price. The best we can do is to compute the Average purchase price of the stock over the past umpteen days. Guess what that is?

It's the VMA!

Well, almost. You see, the VMA assumes all the stock traded at the day's closing price which ain't necessarily so ... but VMA is a good estimate of the average price, right?
P.S. The spreadsheet noted below actually uses the average between the high and low for the day.

Of course, buy low and sell high is a good dictum, but low compared to what? High compared to what?

Compared to the VMA,
that's what!


Example:
You start with, say $10K in CASH and $10K in some stock.
Each time VMA100-day says to BUY you spend 50% of your Cash
(cuz you'll want some left in case there's another BUY comin' up).
Each time VMA100-day says to SELL you sell 50% of your Stock
(cuz you'll want some left in case there's another SELL comin' up).

How does your portfolio compare to the change in stock price?

So what did I choose for A and B?
I picked 'em like so:


A = 4.5 and B = -1.5, and now that I have these numbers (which are a characteristic of this stock over this time period) I use them to give me BUY and SELL signals for the (near) future.
Oh, one more thing ...

It's convenient to know how close we are to a BUY or a SELL. To this end we can, each day, determine the stock price that would have given a BUY or SELL, like so:

For a BUY we want VMA - (P1 + P2 + P3 + P4 + P5)/5 > A

which requires:

P5 < 5 (VMA - A) - (P1 + P2 + P3 + P4)    which we plot, in GREEN.

Further, for a SELL we want VMA - (P1 + P2 + P3 + P4 + P5)/5 < B

which requires:

P5 > 5 (VMA - B) - (P1 + P2 + P3 + P4)    which we plot, in RED.

That gives:



where we BUY (or SELL) when the Stock Price is below (or above) these curves.
You can see a SELL in July and a BUY in September and another SELL may be comin' up ...


What kind of stocks should we consider forVMA?
I figure they should be:
  1. Pretty volatile (so we can play the swings), like mebbe
  2. Expected to go up over the long haul (example)
Aaah ... but consider this one:

Not too exciting (tho' the losses were less than Buy & Hold).


How to choose A & B ?

It's poor technique to choose numbers A, B, which have little relation to the prices and volumes we're considering, so consider choosing them as follows:

We'll SELL when the fast MA is significantly GREATER than the VMA, say 25% greater. That requires

(P1 + P2 + ... + PN)/N > 1.25 VMA

or, let's just say    MA/VMA > 1.25    or, better still

MA/VMA -1 > .25    or 25%

We'll BUY when the fast MA is significantly LESS than the VMA, say 15% less. That requires

MA/VMA -1 < - .15    or -15%

You understand that these percentages, 25% and 15%, are entirely up to us and are inextricably linked to our greed ... so let's call them GREEDY PERCENTAGES.

Anyway ... a picture is in order:


Here we plot MA/VMA -1 and note when it's greater or less than 25%. (Them's the red and green lines, indicating sell or buy)

OR, we could (as we did earlier) plot the stock price as well as the prices that would give a BUY or SELL:


When the Stock Price moves above the SELL line, we ... uh, sell and when it moves below the BUY line ... well, maybe it's better to look at it this way:

We plot the VMA and the MA and the Stock Price and the BUY and SELL and
(assuming we started with equal dollar amounts in CASH and STOCK and used just 50% of each each time there was a buy or sell)
and we can also indicate the VMA Gain compared to the stock gain (over the period shown).


Uh ... did I mention we used a 200-day Volume-weighted Moving Average here?


So, have I made a bundle using VMA?
I'll let you know. (See VMA trial)


There's a spreadsheet to play with:    Volume Weighted Averaging    where the stock data is downloaded from an Internet site and you get to choose your greedy-percentages ... and whether it's 100-day or 157-day VMA and whether you spend ALL or just 47% of your cash when you buy and, when you sell you can sell just 23% of your stock and ... well, you get the idea. PLAY WITH IT!

There is just this proviso:
Should you lose money using VMA I'll claim ignorance ... and this website will self destruct.
Should you make money, I'll accept a small percentage.


Ain't VMA wunnerful?


to be continued ... one-of-these-days