# Stochastic Oscillator (STOCH)

> QuantNexus indicator page for Stochastic momentum analysis.

**Route**: `/quantnexus/indicators/stoch/`

## What It Does

Stochastic compares the close to the recent high-low range. It is used to identify overbought and oversold momentum conditions.

## Formula

`%K = 100 * (Close - Lowest Low(n)) / (Highest High(n) - Lowest Low(n))`

`%D = SMA(%K, 3)`

## Parameters

- `period` - default `14`
- `period_dfast` - default `3`
- `movav` - default `MovingAverageSimple`
- `upperband` - default `80`
- `lowerband` - default `20`
- `safediv` - default `False`
- `safezero` - default `0`
- `period_dslow` - default `3`

## C++23 API

```cpp
#include <nonabt/indicators/stoch.hpp>
auto stoch = std::make_unique<nonabt::STOCH>(data(), 14, 3, "MovingAverageSimple", 80, 20, false, 0, 3);
```

## Common Usage

- Use Stochastic for overbought/oversold conditions.
- Combine it with price structure or trend filters.
- Use crossovers between `%K` and `%D` for timing.

## Practical Pattern

Many mean-reversion systems buy near oversold levels and sell near overbought levels, but only when the broader trend is not too strong.
