# Stochastic Oscillator

Contents[Hide]

The Stochastic Oscillator function compares the close price of a stock against its price range (high-low) over a specified number of time periods. Applications of Stochastic Oscillator include the generation of buy and sell signals.

## 1. Syntax

Stochastic Oscillator:

```STOCOSC(d0,d1,d2,s0,s1,Alignment)
```

Trigger Line:

```STOCOSCTRG(d0,d1,d2,s0,s1,Alignment)
```

## 2. Input

The Stochastic Oscillator functions require the following input series:

• d0 - High data values - The first set of data values for which the Stochastic Oscillator formula is calculated, usually the daily high price of a stock.
• d1 - Low data values - The second set of data values for which the Stochastic Oscillator formula is calculated, usually the daily low price of a stock.
• d2 - Close data values - The third set of data values for which the Stochastic Oscillator formula is calculated, usually the daily close price of a stock.

## 3. Parameters

The Stochastic Oscillator function has the following parameters:

• s0 - Look Back Period - The number of time periods for determining the overall high and low values. Default value is 14.
• s1 - SMA Period - The number of time periods for the simple moving average calculation which is used to generate the trigger line. Default value is 3.
• Alignment (Optional) – Hierarchy placeholder to be used as the alignment axis.

## 4. Output

The STOCOSC function generates the following output:

• Stochastic Oscillator - The Stochastic Oscillator result set.

The STOCOSCTRG function generates the following output:

• Trigger Line - The trigger line is a 3-period, simple moving average that is used to smooth out the Stochastic Oscillator values.