# Stochastic (STOCH)

#### Definition

The Stochastic Oscillator (STOCH) is a range bound momentum oscillator. The Stochastic indicator is designed to display the location of the close compared to the high/low range over a user defined number of periods. Typically, the Stochastic Oscillator is used for three things; Identifying overbought and oversold levels, spotting divergences and also identifying bull and bear set ups or signals.

#### History

The Stochastic Oscillator (STOCH) was developed by George Lane in the 1950's. Lane believed that his indicator was a good way to measure momentum which is important because changes in momentum precede change in price. In a 2007 interview he was quoted as saying "Stochastics measures the momentum of price. If you visualize a rocket going up in the air – before it can turn down, it must slow down. Momentum always changes direction before price.".

#### Calculation

Stochastics can be broken down into two lines; %K and %D. %K is the percentage of the price at closing (K) within the price range of the number of bars used in the look-back period.
`%K = SMA(100 * (Current Close - Lowest Low) / (Highest High - Lowest Low), smoothK)`
%D is a smoothed average of %K, to minimize whipsaws while remaining in the larger trend.'''
`%D = SMA(%K, periodD)`
Lowest Low = The lowest price within the number of recent bars in the look-back period (periodK input)
Highest High = The highest price within the number of recent bars in the look-back period (periodK input)

#### The basics

The Stochastics Oscillator is a range-bound oscillator consisting of two lines that move between 0 and 100. The first line (known as %K) displays the current close in relation to a user-defined period's high/low range. The second line (known as %D) is a simple moving average of the %K line. Now, as with most indicators, all of the periods used within Stochastic can be user defined. That being said, the most common choices are a 14 period %K and a 3 period SMA for %D.

The basic understanding is that Stochastic uses closing prices to determine momentum. When prices close in the upper half of the look-back period's high/low range, then the Stochasitc Oscillator (%K) rises also indicating an increase in momentum or buying/selling pressure. When prices close in the lower half of the period's high/low range, %K falls, indicating weakening momentum or buying/selling pressure.

#### What to look for

##### Overbought/Oversold

Much like with any range-bound indicator, Overbought/Oversold conditions are a primary signal generated by the Stochastic Oscillator. The default thresholds are 20 for oversold and80 for overbought. These are typical levels but may not be suitable for all situations depending on the financial instrument being traded. Finding the correct levels comes with some experimentation as well as historical analysis. Remember, it is typically best to trade along with the trend when using Stochastic to identify overbought/oversold levels. The reason is that overbought does not always mean a bearish move just like oversold does not always mean a bullish move. Many times overbought (oversold) conditions can be a sign of a strengthening trend and not necessarily an impending reversal.

Overbought conditions are when the Stochastic Oscillator crosses the upper threshold.

Oversold conditions are when the Stochastic Oscillator crosses the lower threshold.

##### Divergences

Divergence occurs when movements in price are not confirmed by the Stochastic Oscillator.

Bullish Divergence occurs when price records a lower low, but Stochastic records a higher low.

Bearish Divergence occurs when price records a higher high, but Stochastic records a lower high.

##### Bull/Bear Setups

Bull/Bear Setups are very similar to divergences however, they are an inversion.

A Bull Setup occurs when price records a lower high, but Stochastic records a higher high. The setup then results in a dip in price which can be seen as a Bullish entry point before price rises.

A Bear Setup occurs when price records a higher low, but Stochastic records a lower low. The setup then results in a bounce in price which can be seen as a Bearish entry point before price falls.

#### Summary

The Stochastic Oscillator indicator, is a classic tool for identifying changes in momentum. It is a versatile indicator that can be used over a wide variety of timeframes (days, weeks, months, intraday) which adds to its popularity. When it comes to generating signals, the Stochastic Oscillator can indeed produce quality signals. Keep in mind though, that when using it as a signal generator (especially for divergences and bull/bear setups) it is best when used going with the trend. The technical analyst should be aware of the overall trend of the market. It would not be unwise to use Stochastic along with other means of technical analysis such as trend lines to confirm the market direction.

#### Inputs

##### K

The time period to be used in calculating the %K. 14 is the default. It's periodK; in the Calculation paragraph.

##### D

The time period to be used in calculating the %D. 3 is the default. It's periodD in the Calculation paragraph.

##### Smooth

The time period to be used in additional smoothing of the %K. 3 is the default. Value of 1 disables the additional smoothing. It's smoothK in the Calculation paragraph.

#### Style

##### K

Can toggle the visibility of the %K as well as the visibility of a price line showing the actual current value of the %K. Can also select the %K Line's color, line thickness and visual style (Line is the Default).

##### D

Can toggle the visibility of the %D as well as the visibility of a price line showing the actual current value of the %D. Can also select the %D Line's color, line thickness and visual style (Line is the Default).

##### Upper Band

Can toggle the visibility of a line indicating overbought levels. Can also select the line’s value, line thickness, value and visual type (dashes is the default).

##### Lower Band

Can toggle the visibility of a line indicating oversold levels. Can also select the line’s value, line thickness, value and visual type (dashes is the default).

##### Background

Toggles the visibility of a Background color within the Bands. Can also change the Color itself as well as the opacity.

##### Precision

Sets the number of decimal places to be left on the indicator's value before rounding up. The higher this number, the more decimal points will be on the indicator's value.