Learn R Programming

PortfolioTesteR (version 0.1.4)

calc_stochastic_d: Calculate Stochastic D Indicator

Description

Calculates the Stochastic D indicator for momentum analysis. The %D line is the smoothed version of %K, commonly used for momentum signals in range 0-100.

Usage

calc_stochastic_d(data, k = 14, d = 3)

Value

Data.table with Stochastic D values for each symbol

Arguments

data

Price data with Date column and symbol columns

k

Lookback period for stochastic K calculation

d

Smoothing period for D line

Examples

Run this code
data("sample_prices_weekly")
data(sample_prices_weekly)
data("sample_prices_weekly")
stoch_d <- calc_stochastic_d(sample_prices_weekly, k = 14, d = 3)
head(stoch_d)

Run the code above in your browser using DataLab