The stochastic oscillator, developed by George C. Lane in the late 1950s, is a technical indicator which compares a security's current closing price to the price range over a given amount of time. The amount of time is defined by the number of time periods used to calculate the oscillator value. This oscillator measures the momentum of a stock's price movement.

The stochastic oscillator is actually made up of 2 lines. The %K line is the "fast stochastic line" while the %D is a three day moving average of %D, and is the "slow stochastic line". There are some who also use a Slow %D Line, which is a second three day moving average of the first %D. Here we'll only discuss the %K and %D, and leave off the slow %D.

%K is calculated according to the following equation:

- %K = 100[(C - LP/(HP - LP)]

Where

- C = the current close
- LP = the lowest price of the defined time period
- HP = the highest price of the defined time period

A typical time period for calculating 14 prints. SO C would be today's close, LP would be the lowest low of the last 14 prints, and HP would be the highest high of the last 14 prints.

%D is simply calculated by taking the average of the last 3 values of %D. So it would be the average of the current %D, the previous %D, and the previous previous %D. Add those 3 values together and divide by 3, and you have the current value of %D.

The theory behind this stochastic oscillator is that when prices are going up, prices tend to close near their highs, and when prices and going down, price tend to close near their lows. And these trends tend to be pretty constant in a "nice" market - whether up or down. We look for crossovers between %K and %D as entry signals. For this simple entry signal, %K crossing from lower to higher over %D gives us a buy signal, while %K crossing from above %D to below %D gives us a sell signal. Obviously this must be used in conjunction with other indicators, otherwise you could be thrashed big time during a sideways volatile market.

- The current high less the current low
- The current high less the previous close
- The current low less the previous close

This true range calculation takes into account the fact that the price may have gapped up or down and never closed that gap, thereby including the gapped price action as well as the current bar's price action to get a true sense of the movement during the current period.

The calculations above are to compute the true range for each candle. The Average True Range creates a moving average of the true range calculations - a 14 candle period is typical.