some kinda Wave Theory
We assume:
1. As the stock price, P(n), increases above some magic price, P0, investors SELL (to lock in gains) and the Slope of the Price vs Time chart (namely P(n) - P(n-1)) decreases at a rate proportional to P(n) - P0.
2. As the stock price decreases below some magic price, P0, investors BUY (at bargain prices) and the Slope of the Price vs Time chart increases at a rate proportional to P(n) - P0.
Like so:

Fig.1 Price vs Time

The change in Slope is:

{ P(n+1) - P(n) } - { P(n) - P(n-1) }

and the above assumptions imply that this is proportional to P(n) - P0, hence:
 (1) { P(n+1) - P(n) } - { P(n) - P(n-1) } = - ω2 { P(n) - P0, }

where ω2 is some (as yet unknown) positive constant of proportionality.

Rearranging terms, we get:
 (2) P(n+1) = (2-ω2) P(n) - P(n-1) + ω2 P0
which provides a prediction of the next stock price, P(n+1), in terms of the previous prices P(n-1) and P(n).

How to choose ω2 ?

If we rewrite equation (1) as a differential equation, it becomes:

d2/dt2 P(t) = - ω2 { P(t) - P0, }
and, if P0 is a constant, the solutions oscillate about P0 (as sines and cosines ... stare at the extrapolated part of Fig. 3, below) with a period T related to ω via T = 2π/ω hence ω = 2π/T where T is some period (in days, perhaps), so we rewrite equation (2) as:

the MAGIC equation
 (3)                      P(n+1) = (2-(2π/T)2) P(n) - P(n-1) + (2π/T)2 P0

where we can now choose T in some sanitary manner (like T = 10 days).

How to choose P0 ?

As a first effort, we choose for P0 the Average Price Paid for the stock over the past N days, or VMA(N), the Volume-weighted Moving Average price over N days (see VMA).

Here's an example of what we'd get, using equation (3) and substituting, each day, the two previous stock prices P(n) and P(n-1), with T=10 days and taking the VMA over the previous 20 days:

Fig.2 Predicting the Price P(n+1)

In this example, the direction of the changes in the Predicted price (UP or DOWN) agree with those of the actual price changes 77% of the time. (I'll call this the UP/DOWN Correlation ... why not?)

Also, the NEXT predicted price for May 8/98 is \$16.40 whereas the actual price on May 8 was \$16.09 (an error of 1.9%).

How to choose P(n) ?

Should P(n) be the Open? High? Low? Close? Average? Aaah, that's the question ...
In the meantime, we've taken P(n) = (Hi + Lo)/2.

If we stop using the actual prices P(n) and P(n-1) (at some point in time) and start using the previously predicted prices, we get something like:

Fig.3 Extrapolating the Price

where, in the extrapolated portion of the graph, the chosen value of T = 6 is clearly evident (in that the predicted prices oscillate with a period of about 6 days). Further, the choice of a constant P0 = \$16.75 results in our "predicted WAVE" oscillating about this value.

Here's another stock:

Fig.4 Predicting CBR

Fig.5 Extrapolating CBR

See: more Waves