Stochastic oscillator

stochoscillatorsForge API 1

Where the close sits in the recent high to low range, with a signal line.

Inputs

NameTypeDefaultRange
k_periodint51 to 5000
d_periodint31 to 5000
slowingint31 to 5000
basischoicehigh_low

Outputs

NameTypeRequiredDescription
kvalueOptionalcolor theme.series_a, style line, width 1
dvalueOptionalcolor theme.series_b, dash dash, style line, width 1
Warm-up
k_period + slowing + d_period - 3 bars (8 at the defaults)
Repaints
No
Parity
MetaTrader 5, within 1e-12

Formula

The highest high and lowest low over K period (the highest and lowest close with close_close)

%K = 100 * sum(close - lowest, slowing) / sum(highest - lowest, slowing)

%D = the simple average of %K over D period

A window with no range reads 50.