Skip to content

Stochastic

Indicators · Oscillators

Stochastic node on the canvas

Stochastic oscillator (%K and %D lines, 0..100).

The Stochastic oscillator asks one sharp question: where does this bar close inside its recent range? If price keeps closing near the top of its range, momentum is up; near the bottom, momentum is down. It bounces between 0 and 100, so it's a natural overbought/oversold meter — and because it reads position within range rather than raw price, it often turns ahead of price itself.

How it works

Over the %K period (default 14) the block finds the highest high and lowest low, then plots raw %K as (close − lowest low) / (highest high − lowest low) × 100. That raw line is jumpy, so Smoothing (default 3) averages it — a smoothing of 1 gives you the classic "fast" stochastic, higher values the "slow" one. The %D line is then an SMA of %K over the %D period (default 3); %D is the slower signal line that %K crosses.

Two reference levels mark the extremes — Overbought (default 80) and Oversold (default 20) — drawn as dashed guides in the sub-pane. The block also exposes plain OB and OS signals that fire true when %K pushes past those thresholds, so you can wire conditions without rebuilding the comparison.

When to use it

Stochastic is at its best in ranging, mean-reverting markets: buy as %K turns up out of oversold, sell as it rolls over from overbought. The %K-crosses-%D event inside an extreme zone is the classic trigger. In a strong trend it will sit pinned in overbought (or oversold) for a long time — there, treat extremes as continuation, not reversal, or filter them out entirely. Divergence between price and %K is a high-quality warning of exhaustion.

Example

Stochastic on the EURUSD H1 chart

Stochastic on EURUSD · H1

A range fade: wire bars into Stochastic, take the OS output and combine it with a %K-turning-up condition through a Crosses Above on the %K/%D pair, then route to a Buy Signal. Keep it honest by only trading when ADX / DMI shows a weak trend (a real range), and protect with a Fixed Stop-Loss below the swing low. Backtest in the Tester.

Tips & gotchas

  • Fast vs slow is the Smoothing knob. Smoothing 1 is twitchy and signal-rich but noisy; 3+ is calmer and more reliable. Most traders run the slow version.
  • Don't fade a trend. "Embedded" stochastic — stuck above 80 for many bars — means strong momentum, not a top. Gate extremes with a trend filter.
  • Tune the thresholds to the asset. 80/20 is convention; volatile assets may justify 90/10 to cut false stretches.
  • %K-%D cross > raw threshold. Entering on the lines crossing inside a zone beats entering the instant the zone is touched.
  • Cousin to Stochastic RSI — that one runs this same math on RSI instead of price for an even faster, more sensitive read.

Inputs

Socket Type What to wire in
Bars bars Price bars

Outputs

Output Type Plots as Description
%K series Line · sub-pane %K line (0..100)
%D series Line · sub-pane %D line (smoothed %K)
OB signal %K above threshold
OS signal %K below threshold

Parameters

Parameter Type Default What it does
%K period number · 1–200 14
%D period number · 1–50 3
Smoothing number · 1–50 3 1 = fast stochastic
Overbought number · 50.0–100.0 80.0
Oversold number · 0.0–50.0 20.0
%K color colour #4fc3f7
%D color colour #ffb74d

Chart guides

This indicator draws reference level(s): overbought, oversold.


Reference auto-generated from the block catalog · category Indicators.