Stochastic Oscillator
Note: This is the standard Stochastic Oscillator, not Stochastic RSI. These are different indicators — do not confuse them.
The Stochastic Oscillator compares the closing price to the price range over a specified period, helping identify overbought/oversold conditions and potential reversals.
How it works: The indicator produces two lines: %K (the main line) and %D (a moving average of %K). Values oscillate between 0 and 100. A reading below 20 suggests the asset is oversold; above 80 suggests overbought.
Resources: TradingView Stochastic docs
Settings in block algo flex
| Setting | Description | Default |
|---|---|---|
| Use Stochastic? | Enable/disable the indicator | Off |
| %K Length | Lookback period for %K calculation | 14 |
| %K Smoothing | Smoothing applied to the %K line (1 = no smoothing) | 1 |
| %D Smoothing | Moving average period for the %D line | 3 |
| Timeframe | Timeframe for calculation | Chart |
| Buy K Condition | %K threshold for buy (e.g., "Less Than 20") | Less Than 20 |
| Sell K Condition | %K threshold for sell (e.g., "Greater Than 80") | Greater Than 80 |
| Buy Condition | Crossover event (e.g., %K crosses above %D) | Crossover |
| Sell Condition | Crossunder event (e.g., %K crosses below %D) | Crossunder |
How to Interpret
- %K < 20 — Oversold zone; watch for bullish crossover
- %K > 80 — Overbought zone; watch for bearish crossover
- %K crosses above %D — Bullish signal
- %K crosses below %D — Bearish signal
Pro Tip: The Stochastic works best in range-bound markets. In strong trends, the oscillator can stay in overbought or oversold territory for extended periods. Combine it with a trend indicator (ADX, EMA Price) to avoid trading against the dominant trend.