Dundas Chart for SharePoint Send comments on this topic.
Stochastic Indicator Formula

Glossary Item Box

Overview

When there is an upward trend in the market place, there is also a tendency for the closing price to be very close to that day's high. During a downward trend in the market there is a tendency for the closing price to be closer to the low price. The Stochastic Indicator helps to find trend reversals by searching for a period of time when the closing prices are close to the price lows in an upward market trend, or when closing prices are close to the price highs in a downward market trend.

This formula has two output values: %K - Simple Stochastic Indicator and %D - Smoothed Stochastic Indicator (Moving Average of %K).

 

Note
We recommend that you read Using Financial Formulas before proceeding any further. Using Financial Formulas provides a detailed explanation on how to use formulas, and also explains the various options available to you when applying a formula.

 

Figure 1: The Stochastic Indicators %K and %D in the lower chart area, and the High, Low and Close prices in the upper chart area.

 

Applying Stochastic Indicator

All financial formulas are calculated using the FormulaFinancialmethod, which accepts the following types of arguments: a formula name; input value(s); output value(s), and parameter(s) that are specific to the type of formula being applied.

Also, before applying the FormulaFinancial method, make sure that all data points have their XValue property set, and that their series' XValueIndexedproperty has been set to false.

The following table indicates what sort of FormulaFinancial method arguments to use when calculating an Stochastic Indicator, and also supplies a description of what these parameters mean:

 

Parameter

Value/Description

Example

Formula Name:

StochasticIndicator

 

FormulaFinancial(FinancialFormula.StochasticIndicator,"15,15", _
"Series1:Y,Series1:Y2,Series1:Y4","Series3:Y,Series4:Y")

Input Values: Value #1: Value which represents the High price. By default this is the first Y value in the stock chart.

Value #2:
The value which represents the Low price. By default it is the second y value in the stock chart.

Value #3: The value which represents the Close price. By default this is the fourth Y value in the stock chart.

FormulaFinancial(FinancialFormula.StochasticIndicator,"15,15", _
"Series1:Y,Series1:Y2,Series1:Y4","Series3:Y,Series4:Y")

Output Value:
(optional)

Value #1: %K Simple Stochastic Indicator.

Value #2:
%D Smoothed Stochastic Indicator (Moving average of %K).

 

If not specified output is stored using the first two input values.

FormulaFinancial(FinancialFormula.StochasticIndicator,"15,15", _
"Series1:Y,Series1:Y2,Series1:Y4","Series3:Y,Series4:Y")

Parameters:
(optional)

Parameter #1: PeriodK - used to calculate %K. (Default value 10).

 

Parameter #2: PeriodD - used for %D. Calculated as SMA of %K. (Default value 10).

FormulaFinancial(FinancialFormula.StochasticIndicator,"15,15", _
"Series1:Y,Series1:Y2,Series1:Y4","Series3:Y,Series4:Y")

 

A line chart is a good choice when displaying a Stochastic Indicator series.

Financial Interpretation: The Stochastic indicator value is always between 0 and 100, and is represented as a percentage. If the value is above 80 then the price is closing near the high. If the value is below 20 then the price is closing near its low.

The %D line is more important than %K line, and the %K line changes direction before the %D line. When the %D line changes direction prior to the %K line, a slow and steady reversal is usually indicated. If both the %K and %D lines change direction and the %K line (the FastLine™) changes direction and approaches the %D line but does not cross it then this is a good confirmation of the prior reversal stability.

Calculation: The Stochastic indicator is calculated on the following way:

%K = ( Today's Close - LL ) / ( HH - LL ) * 100

where:

LL = Lowest Low price in PeriodK

HH = Highest High price in PeriodK

%D is calculated as a Moving Average of %K for PeriodD.

Example

This example demonstrates how to calculate Stochastic indicator.

Visual Basic Copy Code

With chartObj.DataManipulator
' Calculates Stochastic indicator. Input Values are High, Low and Close.
' Output Values are %K and %D. There are two periods PeriodK and periodD.
.FormulaFinancial( _
        FinancialFormula.StochasticIndicator, _
        "15,15", _
        "Series1:Y,Series1:Y2,Series1:Y4", _
        "Series3:Y,Series4:Y" _
  )
End With
C# Copy Code
// Calculates Stochastic indicator. Input Values are High, Low and Close.
// Output Values are %K and %D. There are two periods PeriodK and periodD.
chartObj.DataManipulator.FormulaFinancial(
        FinancialFormula.StochasticIndicator,
        "15,15",
        "Series1:Y,Series1:Y2,Series1:Y4",
        "Series3:Y,Series4:Y"
  );