Skip to content
StatePath
Tool Atlasmarket.stochastic

Tool

Stochastic Oscillator

market.stochastic

MarketOscillator

Inputs

No typed inputs.

Outputs

Bundle (untagged)

A bundle of two 0-100 lines: k (slow %K) and d (its %D signal SMA).

The Stochastic Oscillator asks one question: where did price close inside its recent high/low range? 100 means at the very top of the range, 0 at the very bottom. The slow %K / %D pair smooths that answer so crosses are tradeable.

Stochastic Oscillator overview diagram

How it works

For each bar it takes the highest high and lowest low of the last k_period bars and scores the close inside that range from 0 to 100. That raw score is smoothed with an SMA of smooth_k bars to give %K, and %D is an SMA of %K over d_period bars. %K crossing %D near the extremes (classically above 80 or below 20) is the standard signal.

Configuration

k_periodscalar

How many bars define the high/low range. 14 is the classic default; larger ranges make the oscillator slower.

k_period diagram
d_periodscalar

SMA length for the %D signal line (classic 3).

smooth_kscalar

SMA length applied to the raw score before it becomes %K. 1 gives the fast stochastic; 3 the slow one.

Connects to

Feeds into

Examples

  • Fade extremes: only allow long entries while %K is below 20 (price closing near its range lows).
  • Cross trigger: wire k and d into calc.cross to fire when %K crosses above %D.

Common mistakes

  • In a strong trend the oscillator can sit pinned above 80 (or below 20) for a long time - overbought does not mean reversal.
  • Confusing fast and slow variants: smooth_k=1 is the jumpy fast stochastic; the 14/3/3 default is the slow one.

See also