Share via


Stochastic Indicator Formula (Chart Controls)

The stochastic indicator formula calculates the simple stochastic indicator (%K) and the smoothed stochastic indicator (%D). %D is a moving average of %K. The output is a percentage. A value more than 80% indicates that the current price is close to the price high, and a value less than 20% indicates that the current price is close to the price low.

The stochastic indicator is an indicator of upward and downward market trends.

Sample plot of the stochastic indicator

Formula Details

Syntax

Chart.DataManipulator.FinancialFormula(
    FinancialFormula.StochasticIndicator,
    "PeriodK,PeriodD",
    "High,Low,Close",
    "%K,%D")

Parameters

This formula takes two optional parameters.

  • PeriodK
    Period for calculating %K. The default value is 10.
  • PeriodD
    Period for calculating %D. The default value is 10.

Input Values

This formula takes three input Y values.

  • High
    Daily high price.
  • Low
    Daily low price.
  • Close
    Daily close price.

Output Value

This formula outputs two Y values.

  • %K
    Simple stochastic indicator. The default value is 10.
  • %D
    Smoothed stochastic indicator. The default value is 10.

Remarks

The Line chart type is a convenient chart type to display the formula output.

Example

The following example takes input from Series1's Y values for the daily high, low, and close prices (Series1:Y,Series1:Y2,Series1:Y4), and outputs %K on Series3 (Series3:Y) and %D on Series4 (Series4:Y). It uses a period of 15 days to calculate both %K and %D.

Chart1.DataManipulator.FinancialFormula (FinancialFormula.StochasticIndicator, "15,15", "Series1:Y,Series1:Y2,Series1:Y4", "Series3:Y,Series4:Y")
Chart1.DataManipulator.FinancialFormula (FinancialFormula.StochasticIndicator, "15,15", "Series1:Y,Series1:Y2,Series1:Y4", "Series3:Y,Series4:Y");

See Also

Reference

System.Windows.Forms.DataVisualization.Charting
System.Web.UI.DataVisualization.Charting

Concepts

Financial Formulas
Applying Formulas