Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# spctkd

Slow stochastics

## Syntax

```[spctk, spctd] = spctkd(fastpctk, fastpctd)
[spctk, spctd] = spctkd([fastpctk  fastpctd])
[spctk, spctd] = spctkd(fastpctk, fastpctd, dperiods, dmamethod)
[spctk, spctd] = spctkd([fastpctk  fastpctd], dperiods, dmamethod)
skdts = spctkd(tsobj)
skdts = spctkd(tsobj, dperiods, dmamethod)
skdts = spctkd(tsobj, dperiods, dmamethod, ParameterName,ParameterValue, ...)
```

## Arguments

 fastpctk Fast stochastic F%K (vector). fastpctd Fast stochastic F%D (vector). dperiods (Optional) %D periods. Default = 3. dmamethod (Optional) %D moving average method. Default = 'e' (exponential). tsobj Financial time series object.

## Description

[spctk, spctd] = spctkd(fastpctk, fastpctd) calculates the slow stochastics S%K and S%D. spctk and spctd are column vectors representing the respective slow stochastics. The inputs must be single column-oriented vectors containing the fast stochastics F%K and F%D.

[spctk, spctd] = spctkd([fastpctk fastpctd]) accepts a two-column matrix as input. The first column contains the fast stochastic F%K values, and the second contains the fast stochastic F%D values.

[spctk, spctd] = spctkd(fastpctk, fastpctd, dperiods, dmamethod) calculates the slow stochastics, S%K and S%D, using the value of dperiods to set the number of periods and dmamethod to indicate the moving average method. The inputs fastpctk and fastpctk must contain the fast stochastics, F%K and F%D, in column orientation. spctk and spctd are column vectors representing the respective slow stochastics.

Valid moving average methods for %D are exponential ('e'), triangular ('t'), and modified ('m'). See tsmovavg for explanations of these methods.

[spctk, spctd] = spctkd([fastpctk fastpctd], dperiods, dmamethod) accepts a two-column matrix rather than two separate vectors. The first column contains the F%K values, and the second contains the F%D values.

skdts = spctkd(tsobj) calculates the slow stochastics, S%K and S%D. tsobj must contain the fast stochastics, F%K and F%D, in data series named PercentK and PercentD. The skdts output is a financial time series object with the same dates as tsobj. Within tsobj the two series SlowPctK and SlowPctD represent the respective slow stochastics.

skdts = spctkd(tsobj, dperiods, dmamethod) lets you specify the length and the method of the moving average used to calculate S%D values.

skdts = spctkd(tsobj, dperiods, dmamethod, ParameterName, ParameterValue, ...) accepts parameter name/parameter value pairs as input. These pairs specify the name(s) for the required data series if it is different from the expected default name(s). Valid parameter names are

• KName: F%K series name

• DName: F%D series name

Parameter values are the strings that represent the valid parameter names.

## Examples

Compute the slow stochastics for Disney stock and plot the results:

```load disney.mat
dis_FastStoch = fpctkd(dis);
dis_SlowStoch = spctkd(dis_FastStoch);
plot(dis_SlowStoch)
title('Slow Stochastics for Disney')
```

## References

Achelis, Steven B., Technical Analysis from A to Z, Second printing, McGraw-Hill, 1995, pp. 268 - 271.